How to send a game object continuing on its current trajectory (2D)

Ok so in the game I’m making when you press forward you move toward the mouse and it works fine, but I’ve made it so it slowly decreases in speed once you’ve stopped pressing accelerate by carrying on in the direction of a game object that follows the mouse and stops once you’ve stopped pressing accelerate, so it heads towards the same direction as it slows down and it works.

But if you are just hovering your mouse infant of the character you move forward but then just stop because the thing it is heading towards is right in front of it. So it needs to continue on the current trajectory. Sorry if this is really obvious.

Thanks

depending on what engine your using, it sounds like your getting the direction to move in by using something like direction = TargetPos - CurrentPos ?
what you could do is normalise the direction so you end up with a direction vector of unit length 1. this would allow for the direction vector to be the same length no matter how far away the mouse is and then do your movement using that.

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

Privacy & Terms