Sign in to follow this  
lidongheng

How Understand the code in My topic

Recommended Posts

[i]i really need somebody's help My Math is So bad I don't understand some code in the below did somebody can slove my problem
// Ensure that the view movement is relative to the rotation.
D3DXVec3TransformCoord( &m_viewPoint, &m_viewPoint, GetRotationMatrix() );[/i]

[i] // Only calculate the correct view matrix if it is being used.
if( m_isViewing == true )
{
// Create the x axis rotation matrix.
D3DXMATRIX rotationXMatrix;
D3DXMatrixRotationX( &rotationXMatrix, m_viewTilt );[/i]

[i] // Create the combined rotation matrix (i.e. y axis rotation from the
// scene object plus the x axis rotation from the player object).
D3DXMATRIX combinedRotation;
D3DXMatrixMultiply( &combinedRotation, &rotationXMatrix, GetRotationMatrix() );[/i]

[i] // Build a translation matrix that represents the final view point.
D3DXMATRIX viewPointTranslationMatrix;
D3DXVECTOR3 finalViewPointTranslation = GetTranslation() + m_viewPoint;
D3DXMatrixTranslation( &viewPointTranslationMatrix, finalViewPointTranslation.x, finalViewPointTranslation.y, finalViewPointTranslation.z );
something like he use some vector knowlege i don't know How to understand vector?[/i]

Share this post


Link to post
Share on other sites
[quote name='lidongheng' timestamp='1297965726' post='4775489']
[i]i really need somebody's help My Math is So bad I don't understand some code in the below did somebody can slove my problem
// Ensure that the view movement is relative to the rotation.
D3DXVec3TransformCoord( &m_viewPoint, &m_viewPoint, GetRotationMatrix() );[/i]

[i] // Only calculate the correct view matrix if it is being used.
if( m_isViewing == true )
{
// Create the x axis rotation matrix.
D3DXMATRIX rotationXMatrix;
D3DXMatrixRotationX( &rotationXMatrix, m_viewTilt );[/i]

[i] // Create the combined rotation matrix (i.e. y axis rotation from the
// scene object plus the x axis rotation from the player object).
D3DXMATRIX combinedRotation;
D3DXMatrixMultiply( &combinedRotation, &rotationXMatrix, GetRotationMatrix() );[/i]

[i] // Build a translation matrix that represents the final view point.
D3DXMATRIX viewPointTranslationMatrix;
D3DXVECTOR3 finalViewPointTranslation = GetTranslation() + m_viewPoint;
D3DXMatrixTranslation( &viewPointTranslationMatrix, finalViewPointTranslation.x, finalViewPointTranslation.y, finalViewPointTranslation.z );
something like he use some vector knowlege i don't know How to understand vector?[/i]


[/quote]

You don't actually say what your problem is, other than "I don't understand" Do you know what a vector is? Do you know what a matrix is? If you answered no, get a book on linear algebra, or any book on 3D games programming. Do you understand the Functions used, like D3DXMatrixMutiply or D3DXVec3TransformCoord? If not, then checkout MSDN. If neither applies, then you need to provide more information in regards to what your problem is

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