I searched the forum but don't find the answers. I readed a post of irrlicht and havok intergation and try. The rigid bodies motion in irrlicht and in havok are different, like a mirror. The convertion from havok to irrlicht is correct, but the convertion from irrlicht to havok is not correct!
I used this code:
irr::corse::vector3f rot(10.0f, 10.0f, 10.0f);
node->setRotation(rot);
print transform of node...
hkTransform trans1,trans2,trans3;
trans1.set(hkVector(1,0,0), rot.X);
trans2.set(hkvector(0,1,0), rot.Y);
trans3.set(hkVector(0,0,1), -rot.Z);
trans1.setMulEq(trans2);
trans1.setMulEq(trans3);
trans1.m(2,0) *= -1;
trans1.m(2,1) *= -1;
trans1.m(0,2) *= -1;
trans1.m(1,2) *= -1;
print transfrom of havok transform...
two prints of irrlicht and havok are same, but two rotations are not same.
anyone knows the answer please tell me!
My english is very bad then I say sorry!
how to convert the left-handed coordinate to right-handed?
how to convert the left-handed coordinate to right-handed?
Last edited by wuallen on Mon Nov 12, 2012 5:46 am, edited 2 times in total.
Re: how to convert the left-handed coordinate to right-hande
I've never tried Havok, but I recently tried converting meshes from RH to LH. Irrlicht uses LH as far as I understand. To convert from RH (blender software) to RH (Irrlicht):
1) Flip x coords of the verts. x = -x;
1) Flip x normals of the verts. x = -x;
2) Flip surface
3) flip y in texcoords. y = 1- y;
1) Flip x coords of the verts. x = -x;
1) Flip x normals of the verts. x = -x;
2) Flip surface
3) flip y in texcoords. y = 1- y;
IrrNaCl - Irrlicht Port for Google Chrome Native Client - Demo
Iyan 3D - Make your own 3d animation using your iOS Device
Iyan 3D - Make your own 3d animation using your iOS Device
Re: how to convert the left-handed coordinate to right-hande
I tried the code and finded my faults.wuallen wrote:I searched the forum but don't find the answers. I readed a post of irrlicht and havok intergation and try. The rigid bodies motion in irrlicht and in havok are different, like a mirror. The convertion from havok to irrlicht is correct, but the convertion from irrlicht to havok is not correct!
I used this code:
irr::corse::vector3f rot(10.0f, 10.0f, 10.0f);
node->setRotation(rot);
print transform of node...
hkTransform trans1,trans2,trans3;
trans1.set(hkVector(1,0,0), rot.X);
trans2.set(hkvector(0,1,0), rot.Y);
trans3.set(hkVector(0,0,1), -rot.Z);
trans1.setMulEq(trans2);
trans1.setMulEq(trans3);
trans1.m(2,0) *= -1;
trans1.m(2,1) *= -1;
trans1.m(0,2) *= -1;
trans1.m(1,2) *= -1;
print transfrom of havok transform...
two prints of irrlicht and havok are same, but two rotations are not same.
anyone knows the answer please tell me!
My english is very bad then I say sorry!
trans1.set(hkVector(1,0,0), rot.X);
trans2.set(hkvector(0,1,0), rot.Y);
trans3.set(hkVector(0,0,1), -rot.Z);
It should be written like this:
trans2.set(hkvector(0,1,0), rot.Y);
trans1.set(hkVector(1,0,0), rot.X);
trans3.set(hkVector(0,0,1), -rot.Z);
this code is working! But I feel that effects of rotation is not really well.
Re: how to convert the left-handed coordinate to right-hande
I just found the answer. How to convert left-handed coordinate to right-handed is represented as follow:
irr::core::matrix4 irr_mat;
irr_mat.setRotationDegrees(m_rotation);
irr_mat(2, 1) *= -1;
irr_mat(2, 0) *= -1;
irr_mat(0, 2) *= -1;
irr_mat(1, 2) *= -1;
hkTransform phy_mat;
phy_mat.setRows4(
hkVector4(irr_mat(0, 0), irr_mat(1, 0), irr_mat(2, 0), irr_mat(3, 0)),
hkVector4(irr_mat(0, 1), irr_mat(1, 1), irr_mat(2, 1), irr_mat(3, 1)),
hkVector4(irr_mat(0, 2), irr_mat(1, 2), irr_mat(2, 2), irr_mat(3, 2)),
hkVector4(irr_mat(0, 3), irr_mat(1, 3), irr_mat(2, 3), irr_mat(3, 3)));
phy_mat.setTranslation(hkVector4(m_position.X, m_position.Y, -m_position.Z));
irr::core::matrix4 irr_mat;
irr_mat.setRotationDegrees(m_rotation);
irr_mat(2, 1) *= -1;
irr_mat(2, 0) *= -1;
irr_mat(0, 2) *= -1;
irr_mat(1, 2) *= -1;
hkTransform phy_mat;
phy_mat.setRows4(
hkVector4(irr_mat(0, 0), irr_mat(1, 0), irr_mat(2, 0), irr_mat(3, 0)),
hkVector4(irr_mat(0, 1), irr_mat(1, 1), irr_mat(2, 1), irr_mat(3, 1)),
hkVector4(irr_mat(0, 2), irr_mat(1, 2), irr_mat(2, 2), irr_mat(3, 2)),
hkVector4(irr_mat(0, 3), irr_mat(1, 3), irr_mat(2, 3), irr_mat(3, 3)));
phy_mat.setTranslation(hkVector4(m_position.X, m_position.Y, -m_position.Z));