# How do I set shape density in PhysX 3.1?

I'm using PhysX 3.1. I need to give shapes different densities (there are several shapes for my single rigid actor). I know that the shape's density can be set by NxShapeDesc::density in PhysX 2.8, but I can't find such an interface in PhysX 3.1.

I know mass properties can be set in PhysX 3.1 just as the snowman example in the SDK. Is there a direct interface to set density for each shape?

You can't directly set shape density in PhysX 3.1, but you can achieve the same results using the helper methods PxRigidBodyExt::updateMassAndInertia, and setMassAndUpdateInertia. They permit you to specify densities indirectly.

• Thanks, I know that we can set the mass as this method just as the sdk's example, I just want to set density directly to shapes. Jan 12 '13 at 6:26
• i think this is impossible in 3.x Jan 14 '13 at 19:59
• Yes, this is impossible in 3.1, but PhysX add this feature again in 3.2 Mar 21 '13 at 6:06