Move object by curve.

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Move object by curve.

Post by Magnet »

I have a model (such as):
Image

I am move this model by curve.
I want to realize slide my model by this curve.
In each step I have last position and current.
How to ROTATE my model for making the imitations of the repetition of the curvature:
Image
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

There are several posts about rotating nodes to line them up with a vector, and that is exactly what you are trying to do. You want to align the axis (looks like the X axis in your drawing, but you might actually want the Z) to line up with the vector lastPos - curPos.

Travis
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Post by Magnet »

I it is necessary that model was clinging to curve.

I do the swimming of fish on curve.
I d'not know as it is correct align the model. And how to calculate model rotation.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

for some exact results you would need yur curve to be defined by some function.

But I would simply store old position in last frame, calculate future position in next frame, than find out angle from current position to old and future one, add it together then cut it by 2 and you end up with something very close of what you need.
Post Reply