Sign in to follow this  

Moving Airplane?

Recommended Posts

I was wondering if someone could tell me what I am doing wrong. Is there a better way to do a simulation of an airplane? Here is the code that I got: _yaw += _currentTurn; _pitch -= (float)(_currentElevation * cos(_yaw)); Then move forward like this void SpaceCraft::moveCraft(float speed) { D3DXMatrixTranspose( &m_matrix, &m_matrix ); D3DXVECTOR3 vForwards( 0, 0, 0 ); D3DXVec3TransformCoord( &vForwards, &vForwards, &m_matrix ); D3DXVECTOR3 vCurrent(_x, _y, _z); D3DXVec3Normalize(&vForwards, &vForwards); vForwards.x += sin(_yaw) * cos(_pitch) * speed; vForwards.y -= sin(_pitch) * speed; vForwards.z += cos(_yaw) * cos(_pitch) * speed; vCurrent += vForwards * speed; _x = vCurrent.x; _y = vCurrent.y; _z = vCurrent.z; setMatrix(); } [Edited by - carterwjeff on December 8, 2007 5:29:55 PM]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this