1

I'm creating a system in which a player character travels along a defined spline path. Here is what I need to do:

  1. Input an array of Vector3 (XYZ) coordinates.
  2. Generate spline data from those Vector3s.
  3. Return a Vector3 for a given relative distance along the spline (0.0 - 1.0)

I'm using a provided library from here which sort of does what I need, but it the resulting spline has a tendency to "slingshot" around control points by slowing down around curves and speeding up in straightaways. It seems like a natural side-effect of spline interpolation.

Unfortunately, my character needs to travel at a constant speed, and I need a way to derive this.

Is there a good library in C# (or C++ which I can convert) that I can use?

Failing that, is there a decent reference on how spline math works from which I can learn?

Thanks!

Tom Murray
  • 99
  • 10
  • What do you mean by "slowing down around curves and speeding up in straightaways" - a spline does not have any concept of speed on its own, and speed usually means distance/time - that should not have to change regardless of the form of the spline, or? – 500 - Internal Server Error Jan 22 '13 at 18:36
  • What you're looking for is how to [reparameterize your spline](http://homepage.cs.uiowa.edu/~kearney/pubs/CurvesAndSurfacesArcLength.pdf) using something like arc length. If you're more a paper book guy, Computer Animation: Algorithms and Techniques chapter 3 is a good resource. The intro. in the pdf I linked should give you enough terms to find better resources. – Jerdak Jan 23 '13 at 02:08
  • Thank you, I've been looking through several resources and this looks like it will help greatly. – Tom Murray Jan 23 '13 at 09:21
  • Do you have points to go through, and control points too ? (Does [how-to-create-a-cubic-bezier-curve-when-given-n-points-in-3d](http://stackoverflow.com/questions/3526940/how-to-create-a-cubic-bezier-curve-when-given-n-points-in-3d) help at all ?) – denis Jan 23 '13 at 11:12
  • @TomMurray You can [see my implementation](https://github.com/Jerdak/FreeFormDeformation/blob/master/FreeFormDeformation/tyrPather.cpp) of a reparam'd pathing spline. I don't know useful the code is as it lacks comments. But it might be that little bit that gets you the rest of the way. – Jerdak Jan 23 '13 at 19:36

0 Answers0