Jump to content
  • Advertisement
Sign in to follow this  

[help] Moving along bezier curve based paths at consistent intervals

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a 3D path made out of bezier curves.
Naturally moving along the curve is in percentage increments. (0 none, 0.5 half way, 1 full length)
what is the simplest way to get an increment that would keep a consistent absolute speed going through 1 curve into another.
E.G. moving 5 units at a time, as opposed to 5% at a time which would vary with curve size.

Any and all help appreciated,
Thanks in advanced,

Share this post

Link to post
Share on other sites
As you mentioned, computing distance through the curve will always be relative to the knot points. The formula for finding that spline point is simple, just a single matrix multiply. That's why games use splines so often.

But computing the linear distance traveled requires solving an elliptic integral, which is a lot more processing. If you really need to compute accurately you will need good calculus engine; you generally cannot convert an elliptic integral to simple functions, nor can you generalize to an iterative solution.

For an game-useful iterative solution just continue to solve by percentage increments across the spline and have your object move toward that point at a constant velocity. When it would reach or cross that point move to the next increment along the spline. If your increment is small enough the curve will appear smooth, and if it is too small you can simply advance the point multiple times. If your spline contains something like a tight loop, your object will need to respond appropriately, probably by simply passing over the loop.

That way you can move at whatever linear speed you want while still iterating across the curve in percentage increments.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!