Physics

Configuration include file for PhysX SDK.

Classes

Macros

Enumerations

Functions

Structs

Typedefs

Enumerations

enum PxScenePrunerIndex

Built-in enum for default PxScene pruners.

This is passed as a pruner index to various functions in the following APIs.

Values:

enumerator PX_SCENE_PRUNER_STATIC
enumerator PX_SCENE_PRUNER_DYNAMIC
enumerator PX_SCENE_COMPOUND_PRUNER

Functions

inline PxVec4 PxConfigureSoftBodyKinematicTarget(const PxVec4 &target, bool isActive)

Adjusts a softbody kinematic target such that it is properly set as active or inactive.

Inactive targets will not affect vertex position, they are ignored by the solver.

Parameters
  • target[in] The kinematic target

  • isActive[in] A boolean indicating if the returned target should be marked as active or not

Returns

The target with adjusted w component

inline PxVec4 PxConfigureSoftBodyKinematicTarget(const PxVec3 &target, bool isActive)

Sets up a softbody kinematic target such that it is properly set as active or inactive.

Inactive targets will not affect vertex position, they are ignored by the solver.

Parameters
  • target[in] The kinematic target

  • isActive[in] A boolean indicating if the returned target should be marked as active or not

Returns

The target with configured w component

PxAABBManager *PxCreateAABBManager(PxBroadPhase &broadphase)

AABB manager factory function.

Use this function to create a new standalone high-level broadphase.

Parameters

broadphase – [in] The broadphase that will be managed by the AABB manager

Returns

Newly created AABB manager, or NULL

PxBroadPhase *PxCreateBroadPhase(const PxBroadPhaseDesc &desc)

Broadphase factory function.

Use this function to create a new standalone broadphase.

Parameters

desc – [in] Broadphase descriptor

Returns

Newly created broadphase, or NULL

physx::PxParticleClothPreProcessor *PxCreateParticleClothPreProcessor(physx::PxCudaContextManager *cudaContextManager)

Create a particle cloth preprocessor.

See PxParticleClothDesc, PxPartitionedParticleCloth.

Parameters

cudaContextManager[in] A cuda context manager.

physx::PxPhysics *PxCreatePhysics(physx::PxU32 version, physx::PxFoundation &foundation, const physx::PxTolerancesScale &scale, bool trackOutstandingAllocations = false, physx::PxPvd *pvd = NULL, physx::PxOmniPvd *omniPvd = NULL)

Creates an instance of the physics SDK.

Creates an instance of this class. May not be a class member to avoid name mangling. Pass the constant PX_PHYSICS_VERSION as the argument. There may be only one instance of this class per process. Calling this method after an instance has been created already will result in an error message and NULL will be returned.

See also

PxPhysics

Parameters
  • version – Version number we are expecting (should be PX_PHYSICS_VERSION)

  • foundation – Foundation instance (see PxFoundation)

  • scale – values used to determine default tolerances for objects at creation time

  • trackOutstandingAllocations – true if you want to track memory allocations so a debugger connection partway through your physics simulation will get an accurate map of everything that has been allocated so far. This could have a memory and performance impact on your simulation hence it defaults to off.

  • pvd – When pvd points to a valid PxPvd instance (PhysX Visual Debugger), a connection to the specified PxPvd instance is created. If pvd is NULL no connection will be attempted.

  • omniPvd – When omniPvd points to a valid PxOmniPvd instance PhysX will sample its internal structures to the defined OmniPvd output streams set in the PxOmniPvd object.

Returns

PxPhysics instance on success, NULL if operation failed

inline bool PxFilterObjectIsKinematic(PxFilterObjectAttributes attr)

Specifies whether the collision object belongs to a kinematic rigid body.

Parameters

attr[in] The filter attribute of a collision pair object

Returns

True if the object belongs to a kinematic rigid body, else false

inline bool PxFilterObjectIsTrigger(PxFilterObjectAttributes attr)

Specifies whether the collision object is a trigger shape.

Parameters

attr[in] The filter attribute of a collision pair object

Returns

True if the object is a trigger shape, else false

inline PxAggregateFilterHint PxGetAggregateFilterHint(PxAggregateType::Enum type, bool enableSelfCollision)
inline PxU32 PxGetAggregateSelfCollisionBit(PxAggregateFilterHint hint)
inline PxAggregateType::Enum PxGetAggregateType(PxAggregateFilterHint hint)
PxBpFilterGroup PxGetBroadPhaseDynamicFilterGroup(PxU32 id)

Retrieves a filter group for dynamic objects.

Mark dynamic objects with this group when adding them to the broadphase. Each dynamic object must have an ID, and overlaps between dynamic objects that have the same ID will not be detected. This is useful to dismiss overlaps between shapes of the same (compound) actor directly within the broadphase.

See also

PxBpFilterGroup

Parameters

id – [in] ID/Index of dynamic object

Returns

Filter group for the object.

PxBpFilterGroup PxGetBroadPhaseKinematicFilterGroup(PxU32 id)

Retrieves a filter group for kinematic objects.

Mark kinematic objects with this group when adding them to the broadphase. Each kinematic object must have an ID, and overlaps between kinematic objects that have the same ID will not be detected.

See also

PxBpFilterGroup

Parameters

id – [in] ID/Index of kinematic object

Returns

Filter group for the object.

PxBpFilterGroup PxGetBroadPhaseStaticFilterGroup()

Retrieves the filter group for static objects.

Mark static objects with this group when adding them to the broadphase. Overlaps between static objects will not be detected. All static objects should have the same group.

See also

PxBpFilterGroup

Returns

Filter group for static objects.

inline PxFilterObjectType::Enum PxGetFilterObjectType(PxFilterObjectAttributes attr)

Extract filter object type from the filter attributes of a collision pair object.

Parameters

attr[in] The filter attribute of a collision pair object

Returns

The type of the collision pair object.

inline bool PxGetFluid(physx::PxU32 phase)
inline physx::PxU32 PxGetGroup(physx::PxU32 phase)
physx::PxPhysics &PxGetPhysics()

Retrieves the Physics SDK after it has been created.

Before using this function the user must call PxCreatePhysics().

Note

The behavior of this method is undefined if the Physics SDK instance has not been created already.

inline bool PxGetSelfCollide(physx::PxU32 phase)
inline bool PxGetSelfCollideFilter(physx::PxU32 phase)

Typedefs

typedef PxFlags<Px1DConstraintFlag::Type, PxU16> Px1DConstraintFlags
typedef PxFlags<PxActorCacheFlag::Enum, PxU16> PxActorCacheFlags

Collection of set bits defined in PxActorCacheFlag.

See also

PxActorCacheFlag

typedef PxFlags<PxActorFlag::Enum, PxU8> PxActorFlags

collection of set bits defined in PxActorFlag.

See also

PxActorFlag

typedef PxFlags<PxActorTypeFlag::Enum, PxU16> PxActorTypeFlags

Collection of set bits defined in PxActorTypeFlag.

See also

PxActorTypeFlag

typedef PxU32 PxAggregateFilterHint
typedef PxFlags<PxArticulationFlag::Enum, PxU8> PxArticulationFlags
typedef physx::PxFlags<PxArticulationKinematicFlag::Enum, PxU8> PxArticulationKinematicFlags
typedef PxFlags<PxArticulationMotion::Enum, PxU8> PxArticulationMotions
typedef physx::PxFlags<PxArticulationSensorFlag::Enum, PxU8> PxArticulationSensorFlags
typedef PxU32 PxBpFilterGroup

Broadphase filter group.

typedef PxU32 PxBpIndex

Broadphase index. Indexes bounds, groups and distance arrays.

typedef PxFlags<PxConstraintFlag::Enum, PxU16> PxConstraintFlags

constraint flags

See also

PxConstraintFlag

typedef PxU32 (*PxConstraintSolverPrep)(Px1DConstraint *constraints, PxVec3p &bodyAWorldOffset, PxU32 maxConstraints, PxConstraintInvMassScale &invMassScale, const void *constantBlock, const PxTransform &bodyAToWorld, const PxTransform &bodyBToWorld, bool useExtendedLimits, PxVec3p &cAtW, PxVec3p &cBtW)

Solver constraint generation shader.

This function is called by the constraint solver framework. The function must be reentrant, since it may be called simultaneously from multiple threads, and should access only the arguments passed into it.

Developers writing custom constraints are encouraged to read the documentation in the user guide and the implementation code in PhysXExtensions.

Param constraints

[out] An array of solver constraint rows to be filled in

Param bodyAWorldOffset

[out] The origin point (offset from the position vector of bodyA’s center of mass) at which the constraint is resolved. This value does not affect how constraints are solved, only the constraint force reported.

Param maxConstraints

[in] The size of the constraint buffer. At most this many constraints rows may be written

Param invMassScale

[out] The inverse mass and inertia scales for the constraint

Param constantBlock

[in] The constant data block

Param bodyAToWorld

[in] The center of mass frame of the first constrained body (the identity transform if the first actor is static, or if a NULL actor pointer was provided for it)

Param bodyBToWorld

[in] The center of mass frame of the second constrained body (the identity transform if the second actor is static, or if a NULL actor pointer was provided for it)

Param useExtendedLimits

[in] Enables limit ranges outside of (-PI, PI)

Param cAtW

[out] The world space location of body A’s joint frame (position only)

Param cBtW

[out] The world space location of body B’s joint frame (position only)

Return

the number of constraint rows written.

typedef void (*PxConstraintVisualize)(PxConstraintVisualizer &visualizer, const void *constantBlock, const PxTransform &body0Transform, const PxTransform &body1Transform, PxU32 flags)

Solver constraint visualization function.

This function is called by the constraint post-solver framework to visualize the constraint

See also

PxRenderBuffer

Param visualizer

[out] The render buffer to render to

Param constantBlock

[in] The constant data block

Param body0Transform

[in] The center of mass frame of the first constrained body (the identity if the actor is static, or a NULL pointer was provided for it)

Param body1Transform

[in] The center of mass frame of the second constrained body (the identity if the actor is static, or a NULL pointer was provided for it)

Param flags

[in] The visualization flags (PxConstraintVisualizationFlag)

typedef PxFlags<PxContactPairFlag::Enum, PxU16> PxContactPairFlags

Bitfield that contains a set of raised flags defined in PxContactPairFlag.

typedef PxFlags<PxContactPairHeaderFlag::Enum, PxU16> PxContactPairHeaderFlags

Bitfield that contains a set of raised flags defined in PxContactPairHeaderFlag.

typedef PxFlags<PxDataAccessFlag::Enum, PxU8> PxDataAccessFlags

collection of set bits defined in PxDataAccessFlag.

See also

PxDataAccessFlag

typedef PxFlags<PxDeletionEventFlag::Enum, PxU8> PxDeletionEventFlags

Collection of set bits defined in PxDeletionEventFlag.

typedef PxU8 PxDominanceGroup

Group index which allows to specify 1- or 2-way interaction.

typedef PxFlags<PxFilterFlag::Enum, PxU16> PxFilterFlags

Bitfield that contains a set of raised flags defined in PxFilterFlag.

See also

PxFilterFlag

typedef PxU32 PxFilterObjectAttributes

Structure which gets passed into the collision filtering shader and/or callback providing additional information on objects of a collision pair.

typedef PxFlags<PxMPMCuttingFlag::Enum, PxU16> PxMPMCuttingFlags
typedef PxFlags<PxMaterialFlag::Enum, PxU16> PxMaterialFlags

collection of set bits defined in PxMaterialFlag.

See also

PxMaterialFlag

typedef PxFlags<PxPairFlag::Enum, PxU16> PxPairFlags

Bitfield that contains a set of raised flags defined in PxPairFlag.

See also

PxPairFlag

typedef PxFlags<PxParticleFlag::Enum, PxU32> PxParticleFlags
typedef PxFlags<PxRigidBodyFlag::Enum, PxU16> PxRigidBodyFlags

collection of set bits defined in PxRigidBodyFlag.

See also

PxRigidBodyFlag

typedef PxFlags<PxRigidDynamicLockFlag::Enum, PxU8> PxRigidDynamicLockFlags
typedef void *PxSQBuildStepHandle
typedef PxU32 PxSQCompoundHandle
typedef PxU32 PxSQPrunerHandle
typedef PxFlags<PxSceneFlag::Enum, PxU32> PxSceneFlags

collection of set bits defined in PxSceneFlag.

See also

PxSceneFlag

typedef PxFlags<PxShapeFlag::Enum, PxU8> PxShapeFlags

collection of set bits defined in PxShapeFlag.

See also

PxShapeFlag

typedef PxFilterFlags (*PxSimulationFilterShader)(PxFilterObjectAttributes attributes0, PxFilterData filterData0, PxFilterObjectAttributes attributes1, PxFilterData filterData1, PxPairFlags &pairFlags, const void *constantBlock, PxU32 constantBlockSize)

Filter method to specify how a pair of potentially colliding objects should be processed.

Collision filtering is a mechanism to specify how a pair of potentially colliding objects should be processed by the simulation. A pair of objects is potentially colliding if the bounding volumes of the two objects overlap. In short, a collision filter decides whether a collision pair should get processed, temporarily ignored or discarded. If a collision pair should get processed, the filter can additionally specify how it should get processed, for instance, whether contacts should get resolved, which callbacks should get invoked or which reports should be sent etc. The function returns the PxFilterFlag flags and sets the PxPairFlag flags to define what the simulation should do with the given collision pair.

This methods gets called when:

  • The bounding volumes of two objects start to overlap.

  • The bounding volumes of two objects overlap and the filter data or filter attributes of one of the objects changed

  • A re-filtering was forced through resetFiltering() (see PxScene::resetFiltering())

  • Filtering is requested in scene queries

  • Pair of static rigid actors

  • A static rigid actor and a kinematic actor (unless one is a trigger or if explicitly enabled through PxPairFilteringMode::eKEEP)

  • Two kinematic actors (unless one is a trigger or if explicitly enabled through PxPairFilteringMode::eKEEP)

  • Two jointed rigid bodies and the joint was defined to disable collision

  • Two articulation links if connected through an articulation joint

Note

A default implementation of a filter shader is provided in the PhysX extensions library, see PxDefaultSimulationFilterShader.

Note

Certain pairs of objects are always ignored and this method does not get called. This is the case for the following pairs:

Note

This is a performance critical method and should be stateless. You should neither access external objects from within this method nor should you call external methods that are not inlined. If you need a more complex logic to filter a collision pair then use the filter callback mechanism for this pair (see PxSimulationFilterCallback, PxFilterFlag::eCALLBACK, PxFilterFlag::eNOTIFY).

Param attributes0

[in] The filter attribute of the first object

Param filterData0

[in] The custom filter data of the first object

Param attributes1

[in] The filter attribute of the second object

Param filterData1

[in] The custom filter data of the second object

Param pairFlags

[out] Flags giving additional information on how an accepted pair should get processed

Param constantBlock

[in] The constant global filter data (see PxSceneDesc.filterShaderData)

Param constantBlockSize

[in] Size of the global filter data (see PxSceneDesc.filterShaderDataSize)

Return

Filter flags defining whether the pair should be discarded, temporarily ignored, processed and whether the filter callback should get invoked for this pair.

typedef PxFlags<PxSoftBodyFlag::Enum, PxU32> PxSoftBodyFlags
typedef PxFlags<PxTriggerPairFlag::Enum, PxU8> PxTriggerPairFlags

Bitfield that contains a set of raised flags defined in PxTriggerPairFlag.