Maybe I shall be a bit more specific. I can understand the first part of the code:
D3DXVECTOR3 vShipPt; vShipPt.x = m_pShip->vPos.x; vShipPt.z = -m_pShip->vPos.y; vShipPt.y = 0.1f + HeightField( vShipPt.x, vShipPt.z );
|
Basically, vShipPt is the vector that defines the position of the ship (wait a second - it is a point, or is it a vector with direction and maginitude?)
Next snippet:
// Point ahead of ship, on terrain D3DXVECTOR3 vForwardPt; vForwardPt.x = vShipPt.x+sinf(m_pShip->fAngle); vForwardPt.z = vShipPt.z+cosf(m_pShip->fAngle); vForwardPt.y = 0.1f + HeightField( vForwardPt.x, ForwardPt.z );
|
The comment says "Point ahead of ship, on terrian" tells me that maybe it is which direction the ship is pointing to. But then, is not finding the orienation of the ship means finding out which direction the ship is pointing at?
I am having troubles with vForwardPt.x = vShipPt.x + sinf(m_pShip->fAngle) and the line below, vForwardPt.z = vShipPt.z+cosf(m_pShip->fAngle). So basically, the question is:
When you take the x or z coordinate and add it to sine (or cosine, if you are taking the z coordinate), what do you get?
The 3rd piece of code:
// Point to side of ship, on terrain D3DXVECTOR3 vSidePt;vSidePt.x = vShipPt.x+sinf(m_pShip->fAngle + D3DX_PI/2.0f); vSidePt.z = vShipPt.z+cosf(m_pShip->fAngle + D3DX_PI/2.0f); vSidePt.y = 0.1f + HeightField( vSidePt.x, vSidePt.z ); D3DXVECTOR3 vNormalDir;
|
I absolutely I have to clue about what this does. The comment says "Point to side of ship" -- what does that means?
Any tips or advices will be helpful. Thanks!
Edited by - LonelyTower on February 9, 2002 11:53:29 AM
Edited by - LonelyTower on February 9, 2002 11:54:31 AM
"Magic makes the world go round." - Erasmus, Quest For Glory I