Ageia Node Jitter
Ageia Node Jitter
Hi has anyone fixed the Camera Jitter when you attach a camera to a Node with PhysX applied? I think the Ogre engine fixed it with a type of Interpolation. It Jitters quite badly and I don't know of a fix.
Thanks.
Thanks.
I'm fairly sure i'm not... but you might be doing something different to me... How does your scene node get updated with the Physx information? Is it a special scene node type which integrates with Physx or is it a standard irrlicht scene node which has its position and rotation updated via setPosition() and setRotation()?
I'm just using the code either from the SDK or the integration example on here:
Code: Select all
//get wheel actor global position
NxMat34 pose = actor->getGlobalPose();
//get wheel actor position
const NxVec3 pos = pose.t;
//get wheel actor orientation
const NxMat33 orient = pose.M;
//our base matrix
irr::core::matrix4 irrMat;
//get orientation to our base matrix
orient.getColumnMajorStride4(&irrMat.pointer()[0]);
//get position
pos.get(&irrMat.pointer()[12]);
//clear our matrix
irrMat.pointer()[3] = irrMat.pointer()[7] = irrMat.pointer()[11] = 0.0f;
irrMat.pointer()[15] = 1.0f;
//set position/rotation to wheel
_node->setPosition(irrMat.getTranslation());
_node->setRotation(irrMat.getRotationDegrees());
_node->updateAbsolutePosition();
Well i've just released my IrrPhysx wrapper yesterday so feel free to have a fiddle around with the examples, attach the camera to an object and see what happens, i didn't see any jitter with my quick test before.
This is the code i'm using to convert from Physx transformations to Irrlicht transformations:
Incidentally another useful conversion is a Irrlicht rotation vector to a Physx rotation matrix, solved some nasty problems for one person at least!:
This is the code i'm using to convert from Physx transformations to Irrlicht transformations:
Code: Select all
core::vector3df pos;
core::vector3df rot;
NxVec3 p = Actor->getGlobalPosition();
pos.X = p.x;
pos.Y = p.y;
pos.Z = p.z;
NxMat33 m = Actor->getGlobalOrientation();
NxF32 fM[16];
m.getColumnMajorStride4(fM);
core::matrix4 irrM;
irrM.setM(fM);
rot = irrM.getRotationDegrees();
node->setPosition(pos);
node->setRotation(rot);
Code: Select all
core::vector3df rot; // the rotation vector to be converted
NxMat33 mat; // the matrix to receive the conversion
NxMat33 rotX, rotY, rotZ;
rotX.rotX(rot.X * core::DEGTORAD);
rotY.rotY(rot.Y * core::DEGTORAD);
rotZ.rotZ(rot.Z * core::DEGTORAD);
mat = rotZ * rotY * rotX;
Slaine, did you manage to fix the problem? I'm experiencing exactly the same thing right now. I'm using irrPhysX and have no idea how to get rid of the jitter. This is the code I'm using:
This function is being executed right after a call to physxManager->simulate() and physxManager->fetchResults()
Code: Select all
void SomeObject::update() {
core::vector3df vec, rot;
// Update the node's position to that of the physx object
PhysxObject->getPosition(vec);
PhysxObject->getRotation(rot);
irrNode->setPosition(vec);
irrNode->setRotation(rot);
irrNode->updateAbsolutePosition(); // tried without it too, didn't work
camera->setPosition(vector3df(0, 25, -45)); //this is a relative position to the irrlicht node
camera->setTarget(irrNode->getAbsolutePosition());
}