![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | lowpolygon |
I have been following this tutorial on ray casting
http://kidscancode.org/blog/2018/03/godot3_visibility_raycasts/
It is a very well written tutorial and I can understand it quite nicely up to this line
draw_line(Vector2(), (hit_pos - position).rotated(-rotation), laser_color)
I looked up help document , the first parameter is where the line starts to draw, in this case it is a location of a turret. Which I would assume the line should be something like
draw_line(position, (hit_pos - position).rotated(-rotation), laser_color)
script is attached to turret hence the position.
But when I tested , the line is drawn from top of the screen to the target. And if I changed back to vector2() then, it the line would be drawn correctly from turret to target
I am a bit confused on why it is. Am I missing something here ?