I am converting an application from using PhysX 2.73 to using PhysX 3.2. Many features seem to be missing from the new version, or perhaps they have been renamed? For example, I used to be able to do these queries on a rigid body actor:
NxVec3 L = actor->getAngularMomentum();
NxReal E = actor->computeKineticEnergy();
Are these queries no longer available, or have they been moved someplace else? I can’t seem to find anything in the API reference.
You need to check and see if the actor is a “PxRigidBody”, and then from the rigid body you can get angular velocity.
Check the PhysX SDK 3.0 API Reference and look up “PxRigidDynamic” or “PxRigidBody”. There you can see how they are related to an actor.
I hope that helped with some of it at least! :) (I do not use the 3.X version, still stuck in 2.8.4, so I am not that knowledgeable about 3.X yet)
Yes, it is a PxRigidBody, and yes I could get the individual “ingredients” for the quantities I need, but I was wondering if there are convenience functions similar to the ones in 2.7.x. Maybe in one of the “extension” headers? Are these documented somewhere?
There are no convenience functions for calculating the momentum or kinetic energy. I will request that convenience functions will be added to a future version, but I cannot guarantee when these would appear. In the meanwhile, it’s really not much work to implement these at the application level, or to add them to the Extensions code yourself.
You’re right that it is not that hard to add these short convenience functions, once we have all the relevant information. In fact, even more important than the functions themselves, I would request enhancements to the API reference document, to clarify what precisely is being returned for the dynamic variables of rigid bodies. For example, PxRigidBody::getAngularVelocity(); Is that the velocity in the body frame or the world frame. And with components resolved on which frame?