Line2d doesn't follow marker2d

Godot Version

Question

GIF 8-7-2024 11-55-11 AM
this is the nodes layout
Screenshot 2024-08-07 115413
and this is the code

sorry I forgot to remove the comment tags.

the version is godot 4.2.2

and I’m trying to replicate shellshock live aiming system but the line2d doesn’t start at marker2d and doesn’t seem to move unlike the sprite.

use $Marker2D.global_position and if this is still offset use this:
to_local($Marker2D.global_position)

still no luck :pensive:

Sorry should have been more concrete:

Line.set_point_position(0, to_local($Marker2D.global_position))
Line.set_point_position(1, to_local(mouse))

now it no longer follows the mouse and instead goes in a straight line across the screen

Omg made an error again, sorry:

Line.set_point_position(0, Line.to_local($Marker2D.global_position))
Line.set_point_position(1, Line.to_local(mouse))

it has to be local to the Line

1 Like

it worked!!! thank you so much

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.