Godot Version
4.6.3
Question
Hi, Im trying to create a line from point A to point b, got that working, but how do I add a texture(arrow point) to the line2d so that it appears at the end?
If you share code, please wrap it inside three backticks or replace the code in the next block:
func _ready() -> void:
print("hello world")
Draw a Sprite2D at the end, or a Shape.
Hi, I have added a Sprite2D as a child to the Line2D node.
{
public void UpdateLine2d(float direction)
{
AimLine2D.Points = new Vector2[]{Vector2.Zero, Vector2.Up.Rotated(direction) * linePower};
Vector2 lastPointLocal = GetPointPosition(GetPointCount() - 1);
GD.Print(GetPointCount().ToString());
if(GetPointCount() > 0)
{
ArrowS2D.GlobalPosition = ToGlobal(lastPointLocal);
}
}
}
This adds the arrow to the end point : ]
If you’re gonna write down the solution you got to based on my suggestion, and mark THAT as the answer, at least format it properly…