Hi all.
So I’m working on a little spaceship RTS type game and have encountered a problem that I’m not sure how to solve.
My ships use very simply physics (ie. not remotely realistic):
They have a current speed, an acceleration, a max speed and a turning speed.
When the player clicks to move a ship, it begins accelerating towards the clicked location, with its speed increasing at a rate of Acceleration/sec. At the same time, it rotates TurningSpeed degrees/second to face the destination.
Its speed never exceeds its max speed.
Now the situation I have is what to do when the ship gets to its destination.
I don’t want it to just stop dead, I would rather it decelerate slowly to a stop.
But how do I do this so that it lands accurately at its destination?
Does anyone have an idea for some sort of formula to calculate stopping distance?
Or to phrase like a school book math problem:
If the ship is moving at 60/sec and its speed decreases by 20/sec when decelerating, how far from the destination should it start decelerating so that it stops perfects in the right spot?
Anyone have an idea for a good solution to this?