# How to apply constant angular speed to quadratic linear speed?

This topic is 2051 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

If I have a Px(t) = At^3 + Bt^2 + Ct + 0 and Py(t) = 0 for my character's position while running and a constant radians/second that my character can turn, how can I transform that into an explicit formula for Px(t) and Py(t) after turning is applied? Is this related to fresnel and euler spirals or track transition curves? Much thanks to anyone who can give me a strong kick in the right direction.

Edit: I figured out a piece, that I ought to be figuring out P''x(t) and P''y(t) instead of thinking about curves at all.

Edited by pTymN

##### Share on other sites

If "Px(t) = At^3 + Bt^2 + Ct + 0" is a spline giving position and t is time, maybe you want to trivially follow exactly the same path and turn the character as he goes.

If you want something else, like walking more or less in the direction the character is facing, you need to figure out how the new motion with turning is supposed to be related to the old motion without turning.

For example, if the non-turning character position P(t) goes from P1 to P2 in T seconds with undefined facing and the turning speed is w radians/second, you might want to interpolate between the original P(t) and the circular arc A(t) = A0+ A1*(cos (s+w*t), sin (s+w*t)). A0,  A1, starting angle s and likely angular velocity w can be chosen to match endpoints P1 and P2, tangents, or something else.

Or you might want to compute the tangent direction of P(t), let's call it D(t) (an angle, not a vector!), and check that its rate of change doesn't exceed a certain range [-w,w], This would require reconstructing P(t) from its tangent direction at each t value, which also requires arbitrary arc lengths at each t value; clothoid splines are an easy choice for that (constant arc length) but you might prefer something more related to the original cubic spline you try to reproduce.

##### Share on other sites

I think that I have the basis for a solution. I needed to convert from my turn speed to the curvature, the curvature to a circle radius, and finally the circle radius to acceleration towards the center of that circle.

##### Share on other sites

I don't exactly know what you're attempting to do, it does look like you're doing a spline, but you may want to look into Dubin's Curves instead to see if that would help you or not.  (It might not)

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 16
• 9
• 15
• 9
• 11