I am working on a game based around Newtonian physics. Therefore there is no drag and therefore a ship will keep accelerating indefinitely if there is no counter-force acting on it. This is being built within Unreal Engine and it is entirely based on physics thrusters (i.e. "Add Force at Location").
For gameplay purposes I'd like to implement a "speed limit". Consider a simple seek steering behaviour.
Ship A is pursuing
Ship A reaches the "speed limit" at time
Ship B changes direction at time
If I calculate the new direction at
t1, and then "cap" the speed at time
t1 + 1 frame,
Ship A will continue on its original direction, because accelerating towards another direction would make its total linear velocity greater than the speed limit.
If instead of calculating the "global" instantaneous velocity I only calculate the projection of the velocity vector along its forward axis, then it works.
However, there are some fringe cases. For example if the new direction is almost orthogonal to the velocity vector, then that means that its projection on the forward axis will be very small in magnitude. The ship will thus reach speeds well above the limit, only to have a "hard brake" when the velocity projection reaches the limit on its forward axis.
Which other methods could I use to limit speed? I thought about removing a software-based limit altogether and just make sure that the ship is braking whenever it is close to the limit. While more realistic, I'm afraid it might look less interesting.