Closed xieshengfly closed 7 years ago
Hello, thank you for using OimoPhysics! So far, there are no methods to get euler angles from Mat33, but you may be able to get euler angles by using Matrix3D.decompose() after copying matrix elements to Matrix3D from Mat33.
Hello saharan.I use OimoPhysics in Alternativa3D.It goes well except a little bug!The rotation is not nicety sometime.
Mat44.as
private var rowData:Vector.
Alternativa3D.as
public function update():void
{
controller.update();
world.step();
i=world.rigidBodies.length;
while(i--){
tempRigidBody=world.rigidBodies[i];
if(tempRigidBody&&tempRigidBody.object3D){
m44.copyMat33(tempRigidBody.rotation);
m44.e30 = tempRigidBody.position.x;
m44.e31 = tempRigidBody.position.y;
m44.e32 = tempRigidBody.position.z;
matrix3D.copyRawDataFrom(m44.getRowData());
tempRigidBody.object3D.matrix2=matrix3D;
}
}
camera3D.render(stage3D);
Object3D.as
public function set matrix2(value:Matrix3D):void {
var v:Vector.
hmm... I think that Matrix3D is transposed, because there are elements of translation in e30 - 32. So I suggest you to try the following code:
public function getRowData():Vector.<Number> {
rowData[0] = e00;
rowData[1] = e10;
rowData[2] = e20;
rowData[3] = e30;
rowData[4] = e01;
rowData[5] = e11;
rowData[6] = e21;
rowData[7] = e31;
rowData[8] = e02;
rowData[9] = e12;
rowData[10] = e22;
rowData[11] = e32;
rowData[12] = e03;
rowData[13] = e13;
rowData[14] = e23;
rowData[15] = e33;
return rowData;
}
...and change
m44.e30 = tempRigidBody.position.x;
m44.e31 = tempRigidBody.position.y;
m44.e32 = tempRigidBody.position.z;
to
m44.e03 = tempRigidBody.position.x;
m44.e13 = tempRigidBody.position.y;
m44.e23 = tempRigidBody.position.z;
good luck :)
Hello! OimoPhysics is wonderful and fast. I have a problem that I dont know how to get the RigidBody rotation(XYZ). The rotation is A Mat33. Thanks.