Aeluned
05-25-2004, 04:31 AM
I have a motion path in 3D space (a series of joined bezier curves). The application I'm working on allows the user to create graphics animations. Suppose I have a bitmap placed on a given motion path. I'm trying to align the front face of the bitmap to the motion path.
the problem basically boils down to this:
I have two vectors - the bitmaps surface normal vector (always <0,0,1>) and the vector defined by the object's xyz position at time t and t+1 - this vector would be (t+1x-tx,t+1y-ty,t+1z-tz);
now, I need to subject the bitmap to a certain series of rotations in order to align its normal vector to the vector defined by the path.
I had tried mapping the path vector first onto the xy plane, determining the y rotation needed, then mapping the vector onto the yz plane in order to figure out the x rotation. Apparently there's a z rotation element which I'm not able to figure out.
I hope I've made what I'm trying to do a little clear :) .
So, I don't want the object on the path to simply position itself at the XYZ positions but also face the direction it's going in.
Thanks for any help.
the problem basically boils down to this:
I have two vectors - the bitmaps surface normal vector (always <0,0,1>) and the vector defined by the object's xyz position at time t and t+1 - this vector would be (t+1x-tx,t+1y-ty,t+1z-tz);
now, I need to subject the bitmap to a certain series of rotations in order to align its normal vector to the vector defined by the path.
I had tried mapping the path vector first onto the xy plane, determining the y rotation needed, then mapping the vector onto the yz plane in order to figure out the x rotation. Apparently there's a z rotation element which I'm not able to figure out.
I hope I've made what I'm trying to do a little clear :) .
So, I don't want the object on the path to simply position itself at the XYZ positions but also face the direction it's going in.
Thanks for any help.