Jump to content
  • Advertisement
Sign in to follow this  
bignester

Animate a plane along a cubic curve

This topic is 5400 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 simple representation of a plane being a rectangle for the body and another rectangle for the wings. This is all in 3D. I want to animate this plane along a cubic curve but i have to tilt the plane with the curve. I want to divide this curve into five segments and draw the plane at each point of these segments. I have no idea how to accomplish any pointers would be great thanx for the help. Bignester

Share this post


Link to post
Share on other sites
Advertisement
Let f(t) be your path curve function (t is time).
You could align the plane along the vector f(t + d) - f(t - d), where d is some small time increment.

Share this post


Link to post
Share on other sites
yes. to elaborate on the above:

you can get one vector associated with the curve by taking its derivative. however, you need more than one direction to define a complete orientation in 3d. so you can also take the second derivative (both analitical btw).

if you normalize both these directions, then take the crossproduct, youve got three orthogonal vectors, which you can interpret as the column vectors of a transformation matrix.

i think that should give quite a natural orientation of the objects along your path aswell.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
That's called the 'osculating plane' - should be contained in a good calculus book or you can google for it.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
all right now my question is how do i get the z point from this equztion.

y=ax^3+bx^2+cx+d

There is only a y and a x, I know this is a simple math question if I can get my 5 sample points I believe I can finish the rest.

thanx again for the help.

Share this post


Link to post
Share on other sites
Hi,

You'll need to be comfortable with calculus for sure. This should help though:

www-2.cs.cmu.edu/~fp/courses/ graphics/asst5/cameraMovement.pdf

I'm sure Dave Eberly's magic site (please google for it) has a document on this, specifically re-parameterisation by arc length. I successfully used this technique for fish shoaling movements along a spline. Good luck!

Cheers,

Martin.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
how do i get the z point from this equztion.
y=ax^3+bx^2+cx+d
There is only a y and a x


If z is not part of the path function, then z is undefined, and there is not way to extract a z component for the vector. In other words, your plane's z position does not change within the path, so the z component of the plane's orientation is always 0.

I'm a bit rusty on my math, so someone let me know if I'm wrong here.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I was just told that a,b,c,d are all vectors and that X,Y,Z are independent. If so then do the vectors have three different elements for the X,Y,Z direction.
modified function
U(t)=a*t^3+b*t^2+c*t+d (where a,b,c,d are vectors) am I completely wrong here.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
I was just told that a,b,c,d are all vectors and that X,Y,Z are independent. If so then do the vectors have three different elements for the X,Y,Z direction.
modified function
U(t)=a*t^3+b*t^2+c*t+d (where a,b,c,d are vectors) am I completely wrong here.


If this is the case, then your plane's orientation ("tilt") will be a vector tangent to the curve. You could find this tangent line using calculus, or you could approximate it using the function I gave before, or something similar:

v = U(t + n) - U(t - n), where v is the plane's orientation and n is a small time interval.

Does this answer your question?

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!