Linear algebra dude. Use matrices and vectors. When you say heading, i think you mean translation. And when you say tilt, i think you mean rotation.
Object::UpdatePosition(Vector dTranslation, float dxrot, float dyrot, float dzrot){ Matrix m; m.LoadIdentity(); m = Matrix::GetXRotation(xrot); m *= Matrix::GetYRotation(yrot); m *= Matrix::GetZRotation(zrot); m += dTranslation; m_vPosition = m * m_vPreviousPosition; m_vPreviousPosition = m_vPosition; // setup for next frame}
|
The implementation of a Matrix and Vector class has been left as an exercise for the reader.
(Don't you hate it when textbooks say that)
Edited by - Parveen Kaler on August 3, 2001 8:44:19 PM