Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


cathode26

Member Since 21 Apr 2006
Offline Last Active Jun 09 2013 04:03 PM

Posts I've Made

In Topic: Rotation in a sub node.

03 May 2013 - 08:11 PM

The actual solution...  I solved it..  This is how  you rotate properly in world space.  If you look closely I had switched the order of the multiplication during the calculation of the world transform.

 

D3DXMATRIX worldRotation(*(node->rn_worldMatrix));
D3DXMATRIX worldTranslation; D3DXMatrixIdentity(&worldTranslation);
worldTranslation(3,0) = worldRotation(3,0);  
worldTranslation(3,1) = worldRotation(3,1);  
worldTranslation(3,2) = worldRotation(3,2);

worldRotation(3,0) = 0;
worldRotation(3,1) = 0;
worldRotation(3,2) = 0;

D3DXMATRIX worldTransformation = worldRotation*rotationMat*worldTranslation;
localTransformation = worldTransformation*parentInverseWorld;

In Topic: Rotation in a sub node.

03 May 2013 - 04:24 PM

This is the code I tried to use for the world rotation of the sub nodes but this gives similar results to the parent code,  but worse because there is eventually some distortion and my axes eventually stops being world for the child node when the parent has not even been rotated.  

 

D3DXMATRIX worldRotation(*(node->rn_worldMatrix));
D3DXMATRIX worldTranslation; D3DXMatrixIdentity(&worldTranslation);
worldTranslation(3,0) = worldRotation(3,0);  
worldTranslation(3,1) = worldRotation(3,1);  
worldTranslation(3,2) = worldRotation(3,2);

worldRotation(3,0) = 0;  
worldRotation(3,1) = 0;  
worldRotation(3,2) = 0;

D3DXMATRIX worldTransformation = rotationMat*worldRotation*worldTranslation;

//I need to convert it to local

FLOAT determinant;
D3DXMATRIX parentInverseWorld;
D3DXMatrixInverse(&parentInverseWorld, &determinant, &parentWorldTransform);

localTransformation = worldTransformation*parentInverseWorld;

 

 

I also tried changing the coordinate space of the rotation into the local coordinate space and applying the rotation there.  With similar results, I can rotate the child in world space if the parent is not rotated.

 

D3DXMATRIX localRotation((*(node->rn_matrix)));
D3DXMATRIX localTranslation;  D3DXMatrixIdentity(&localTranslation);

localTranslation(3,0) = localRotation(3,0);  
localTranslation(3,1) = localRotation(3,1);  
localTranslation(3,2) = localRotation(3,2);
localRotation(3,0) = 0;  
localRotation(3,1) = 0;  
localRotation(3,2) = 0;

D3DXMATRIX deltaRotationLocal = rotationMat*parentInverseWorld;
localTransformation = localRotation*deltaRotationLocal*localTranslation;

In Topic: Cost / Time analysis in Casino Games

22 April 2006 - 10:03 AM

Thanks everyone for responding, I really appreciate your input. I know the job is out of my league. I am posting this because I really dont want to give the job up. I am asking for the knowledge of people that have done this project already so I can get an idea on how these projects are managed. If anyone knows of any websites or books that can teach me how to take on a task like this please let me know. Dont worry about it being out of my league. :)

Thanks

-Vince

PARTNERS