Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualcathode26

Posted 03 May 2013 - 08:13 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;

#7cathode26

Posted 03 May 2013 - 08:12 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 = rotation*parentInverseWorld;
localTransformation = localRotation*deltaRotationLocal*localTranslation;

#6cathode26

Posted 03 May 2013 - 05:20 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 = rotation*parentInverseWorld;
localTransformation = localRotation*deltaRotationLocal*localTranslation;

#5cathode26

Posted 03 May 2013 - 04:54 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. 

 

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;

#4cathode26

Posted 03 May 2013 - 04:51 PM

This is the code I tried to use for the world rotation of the sub nodes but this gives the same results as the parent code.  It doesn't work on subnodes.

What this rotation does is a rotation at its local orientation when the parent node has been rotated.  If the parent has not been rotated, then the child rotates correctly, in world space.  

 

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;

#3cathode26

Posted 03 May 2013 - 04:49 PM

This is the code I tried to use for the world rotation of the sub nodes but this gives the same results as the parent code.  It doesn't work on subnodes.

What this rotation does is a rotation at its local orientation.  

 

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;

PARTNERS