Get mass matrix and collision coordinates in local object coordinates

Hi

I have two questions about collisions in PhysX. I’m currently implementing an algorithm for haptics, and therefore need the mass matrix of a physX object. I use physx::PxRigidStatic and physx::PxRigidDynamic objects. Is there a function that gives me the mass matrix?

And how do I get the collision points in the local coordinate system of the object, and not in world coordinates?

Thanks,
Robert

For the mass matrix I have no clue, you could probably calculate one. But I’m to much of a rookie at mechanics to even know where to start.

Transformation on the other hand. You just need to take the world matrix of the object, which local space you want the point in. Then transform the point with the inverted world matrix.

Thanks for the reply. So you mean this?

physx::PxShape *shape = …
shape->getLocalPose().transformInv(physx::PxVec3(x, y, z));

Or is this the wrong transformation?

Almost, should be:

physx::PxShape *shape = …
shape->getGlobalPose().transformInv(physx::PxVec3(x, y, z));

Then the Vector will be in the shapes local space.

The mass matrix does not exist, you probably mean the inertia matrix or just the mass (or both depending on your intentions). As you mention to implement something for haptics, you probably want both to set controller parameters (e.g. Stiffness). Then you need the mass for tranlational control parameters and the inertia for rotational control parameters. For both you can find the functions in the physx documentation. Note that the inertia “matrix” provides you a PxVec3 with only the diagonal terms of the matrix (don’t bother on the of diagonal terms, you don’t need, want and have them)