Archived

This topic is now archived and is closed to further replies.

Catmull-Rom track with loop

This topic is 5338 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

Check these weird images out: loop pic another loop pic Hi there. Ive been experimenting with creating a race track with the help of catmull-rom interpolation. For every small segment I calculate the tangent for it. Then I need the a right-vector to be able to construct the geometry. I get this by first taking the cross product of the tangent and [0 0 1] (to get the z-axis to be the up vector), then I rotate that vector by X degrees (every segment has a calculated orientation). This all works nice, except when I tried to make a loop (and I think I would get the same if i were to make the track go upside-down). At two points in the loop the track swings around 180 degrees very quickly and that isnt what I want, really. Does anyone know how to solve this? I suspect I need to change [0 0 1] to [0 0 -1] when the track goes upside down, but how do I determine when it does? Lantz [edited by - Lantz on May 5, 2003 12:28:54 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
One way is to have a second spline specifying your up direction at all times. This also has the advantage of easily being able to create banked tracks.

Share this post


Link to post
Share on other sites
Hmm yea I guess that could be pretty smart. Although it may not be as simple to make the tracks with that as I probably will do them manually in some text-file or something. Right now I have a set of points where each point have an associated angle and that''s pretty easy to use when designing the tracks.

Does anyone else have any suggestion?

Share this post


Link to post
Share on other sites