![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | echinococcus |
![]() |
Old Version | Published before Godot 3 was released. |
Hey guys I need a bit of help, I’m creating RTS like game and I’m stuck with KinematicBody movement.
When I click the right mouse button the code does a ray cast and gets the location on the ground where the body should move. Now I get the direction vector by doing:
(player_position - location).normalized()
The body moves like it’s supposed too, I’ve limited the movement on Z and X axis.
Now I can’t get the body to stop on exact location:
I tried to do something like this:
if (player_position == location):
#stop
Basically comparing Vector3s, but they never match exactly, since I’m using the move function to move the KinematicBody.
Do you have any idea how I can stop the body on that location on the ground, I was thinking of creating an offset or something, but I can’t really get it to work.
Any help will be appreciated.
Thanks!