Public Group

Rotating an object along a curve

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

Recommended Posts

Hey, I have an object that follows a Bezier Curve(in 2D), however I need it to rotate with the tangent of the curve as it follows. Currently I am taking the derivative of the Bezier Curve with respect to a time variable u, and taking the x and y coordinates at that u derivative location to use in my rotation matrix. My matrix looks like this:

| x/r  -y/r  0  0  |

| y/r   x/r  0  0  |

|  0     0   1  0  |

|  0     0   0  1  |

where the x and y values are the ones I took from the position at the derivative with respect to u and r = sqrt(x^2 + y^2).

Then I multiply this matrix to the object matrix.

Am I going about this correctly? If so, i'm probably messing up on my derivative. If not, what should be I doing?

Share on other sites
The matrix seems reasonable to me. Perhaps the derivative is wrong.

You could just approximate the derivative at the point by picking another point slightly further up the curve, take the difference, and use that for your x and y values in that matrix the same way. Perhaps this is what you're already trying? Edited by Nypyren

Share on other sites

I wasn't doing it that way, but I will definitely give it a try. That way I can fall back to it if I can't figure out the derivative. Thank you.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• Forum Statistics

• Total Topics
633732
• Total Posts
3013583
×