After a quick skim on the internet, I can't seem to find enough info on how about going to get the reflection transformation of an object reflected in its own axis.
Does anyone have any info? Or Tips for me please
The story is I have an object placed in the scene, but its facing the wrong direction in the Y axis (up axis). 180 degrees
Yes, forget to say, direct3d API that is
I have checked D3DXMatrixReflect, but it is reflecting against a plane? Not sure how it works
I have also tried D3DXMatrixRotationY to no avail...
Thanks
Jack
Doing Reflection Transformation
If I have understood you correctly, you just want to flip the object vertically...Try D3DXMatrixRotationX or D3DXMatrixRotationZ.
Yes, I want to flip it. But i have tried D3DXMatrixRotationX/Z, but it results the same. Do those functions flip the object in their own axis or around the origin?
Another Problem I am having is the Vector "pos" is cleared to 0,0,0 after the operation
Thanks Jack
D3DXMATRIX matr[4];
matr = m_TruckPos.mat;
D3DXMatrixRotationZ(&matr, 1.57f);
pos.x = matr._41;
pos.y = matr._43;
pos.z = matr._42;
Another Problem I am having is the Vector "pos" is cleared to 0,0,0 after the operation
Thanks Jack
D3DXMatrixRotation builds a matrix that rotates around axis, so last row has nothing to with rotation and thats why you see 0's.
First you want to make sure that your "object" is centered at origin, do this in modeling editor.
Then apply rotation and after that apply translation:
Optionaly if you want to add scaling you must multiply matrices in this order:
First you want to make sure that your "object" is centered at origin, do this in modeling editor.
Then apply rotation and after that apply translation:
D3DXMATRIX rotationMatrix;
D3DXMATRIX translationMatrix;
D3DXMATRIX finalTransformationMatrix;
//apply rotation
D3DXMatrixRotation...(&rotationMatrix) <-- here use rotation functions
//apply translation
D3DXMatrixTranslation...(&translationMatrix) <--here use translation functions
//combine
finalTransformationMatrix = rotationMatrix * translationMatrix;
device->SetTransform(D3DTS_WORLD, &finalTransformationMatrix);
DrawObject();
Optionaly if you want to add scaling you must multiply matrices in this order:
finalTransform = rotation * scale * translation;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement