NVIDIAGameWorks / PhysX

NVIDIA PhysX SDK
Other
3.11k stars 793 forks source link

What is analog for NxActor::moveGlobalPose() in PhysX SDK 4.1? #598

Closed SNMetamorph closed 10 months ago

SNMetamorph commented 1 year ago

I'm porting old physics code from PhysX SDK 2.8.3 to 4.1 version. And I can't find modern analog for method NxActor::moveGlobalPose(). There is no information about it in migrating from 2.x to 3.x guide. Thanks!

jcarius-nv commented 1 year ago

PxRigidDynamic::setKinematicTarget() should do the job.

SNMetamorph commented 1 year ago

Thanks! What about other functions and enums, like: NxActor::setLinearMomentum NxActorFlags::NX_AF_DISABLE_COLLISION

SNMetamorph commented 1 year ago

And what about force fields which are presented in PhysX SDK 2.8?

jcarius-nv commented 1 year ago

PxRigidBody::setForceAndTorque allows for different modes, e.g., applying force, impulse (momentum), and velocity change.

If you don't want a shape to partake in collisions you can set the eSIMULATION_SHAPE of the shape to 0. More advanced collision setup is possible with collision filtering, there's a section about this in the guide.

Force fields have been removed since PhysX 3.0, see release notes "What's New In NVIDIA PhysX 3.0"

SNMetamorph commented 1 year ago

@jcarius-nv thanks! Are there some replacements for force fields, or maybe it can be implemented manually?

jcarius-nv commented 1 year ago

Unfortunately there is no replacement. It just has to be done by the user through addForce & scene queries or triggers etc.

SNMetamorph commented 1 year ago

I'm stuck again with this old functions: NxShape::getGlobalPosition NxShape::getGlobalOrientation What will be replacement in PhysX SDK 4.1 version? Please.

PierreTerdiman commented 1 year ago
class PxShapeExt
{
public:
    /**
    \brief Retrieves the world space pose of the shape.

    \param[in] shape The shape for which to get the global pose.
    \param[in] actor The actor to which the shape is attached

    \return Global pose of shape.
    */
    static PX_INLINE    PxTransform     getGlobalPose(const PxShape& shape, const PxRigidActor& actor)
    {
        return actor.getGlobalPose() * shape.getLocalPose();
    }