Moving Airplane?

Started by
-1 comments, last by carterwjeff 16 years, 4 months ago
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]

This topic is closed to new replies.

Advertisement