OGL_PGR

10-07-2005, 07:31 PM

Please help me to extract Yaw,Pitch & Roll angles from a curve....

I have a cubic spline in 3d space and I have an object that moves along the curve( Basically, trying a simulate a roller-coaster kind of motion )

So, based on any 2 points on the curve ( say, deltaCurrent and deltaNext ), is it possible to get Yaw, Pitch and Roll angles ?

After getting the 3 angles, I'm hoping that this method would work:

//------ Start of DrawGL() ---------

// I'm assuming that object-axis = x-axis

0)glPushMatrix();

1)glTranslatef(deltaCurrent);

2)glRotatef(-Yaw, 0.0f, 1.0f, 0.0f);

3)glRotatef(-Pitch, 0.0f, 0.0f, 1.0f);

4)glRotatef(-Roll, 1.0f, 0.0f, 0.0f);

5)DrawOject();

6)glPopMatrix();

...

...

// move the object to next point on the

// cubic spline

7)UpdateObjectPosition();

//------ End of DrawGL() ---------

Please help me out !

Thanks.

I have a cubic spline in 3d space and I have an object that moves along the curve( Basically, trying a simulate a roller-coaster kind of motion )

So, based on any 2 points on the curve ( say, deltaCurrent and deltaNext ), is it possible to get Yaw, Pitch and Roll angles ?

After getting the 3 angles, I'm hoping that this method would work:

//------ Start of DrawGL() ---------

// I'm assuming that object-axis = x-axis

0)glPushMatrix();

1)glTranslatef(deltaCurrent);

2)glRotatef(-Yaw, 0.0f, 1.0f, 0.0f);

3)glRotatef(-Pitch, 0.0f, 0.0f, 1.0f);

4)glRotatef(-Roll, 1.0f, 0.0f, 0.0f);

5)DrawOject();

6)glPopMatrix();

...

...

// move the object to next point on the

// cubic spline

7)UpdateObjectPosition();

//------ End of DrawGL() ---------

Please help me out !

Thanks.