my set up is a Sprite node, under the sprite node I have a ray cast 2D and a line 2D
Line2D has 2 points set up
And I have the following code :
onready var line = $Line2D
onready var ray = $RayCast2D
var hit_position := Vector2.ZERO
var is_firing := false
if ray.get_collider() == target:
is_firing = true
hit_position = ray.get_collision_point()
is_firing = false
func fire_beam(collision_point : Vector2):
var local_pos = transform.xform_inv(collision_point)
But when I run the line doesn't draw to the collision point.
I converted the collision position to local because I saw a youtube video which mentioned that it is in local space so I should draw it in local space.
And it is still not drawing to the collision point. I am not sure what I did wrong