I need to calculate the movement of an object that is slowing down to approach its destination while turning. Calculating the linear stopping distance and deceleration is straightforward. However if the object is not pointing at the destination, and has a limited rotation speed, makes this more complicated. For example imagine it starts pointing 90 degrees off the target: its rotation will increase the distance to the target.

The turning circle increases the distance to the target, but decelerating makes the subsequent turning circle tighter, and I'm not sure how to take in to account both factors.

Basically I have the following information:

  • starting position, angle, and speed
  • target position
  • deceleration
  • rotation speed

and I need to calculate the distance (or time) to the target. What is the calculation for that?

I can also see that if the starting speed is too high, it may not be solvable - in which case it would be useful to also calculate the maximum possible speed.

  • 1
    \$\begingroup\$ This doesn't look like a problem that will have a closed-form solution. You might need to iteratively approximate instead. Can you show us how you integrate your variables to compute the position & orientation of the object in the next timestep? This will ensure we have no misconceptions about your control model. \$\endgroup\$ – DMGregory Sep 10 at 16:41
  • \$\begingroup\$ In most cases, this should be an elliptical path yes? You have 2 points which is your starting and finishing point and you know that the facing of your player corresponds to the tangent at those points. With that, I believe you can then calculate the distance of the path using the ellipses circumference calculation, and taking 1/4th of that. Just off the top of my head, you then at least solve for the perfect solution. This does not though solve for whether you can change direction fast enough to follow that path. This is all very rough, just a thought. \$\endgroup\$ – ErnieDingo Sep 10 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.