Immediatemode

Classes

struct  PxRigidBodyData
 Structure to store rigid body properties. More...
 
class  PxContactRecorder
 Callback class to record contact points produced by immediate::PxGenerateContacts. More...
 

Functions

PX_C_EXPORT PX_PHYSX_CORE_API void PxConstructSolverBodies (const PxRigidBodyData *inRigidData, PxSolverBodyData *outSolverBodyData, const PxU32 nbBodies, const PxVec3 &gravity, const PxReal dt)
 Constructs a PxSolverBodyData structure based on rigid body properties. Applies gravity, damping and clamps maximum velocity. More...
 
PX_C_EXPORT PX_PHYSX_CORE_API void PxConstructStaticSolverBody (const PxTransform &globalPose, PxSolverBodyData &solverBodyData)
 Constructs a PxSolverBodyData structure for a static body at a given pose. More...
 
PX_C_EXPORT PX_PHYSX_CORE_API PxU32 PxBatchConstraints (PxSolverConstraintDesc *solverConstraintDescs, const PxU32 nbConstraints, PxSolverBody *solverBodies, PxU32 nbBodies, PxConstraintBatchHeader *outBatchHeaders, PxSolverConstraintDesc *outOrderedConstraintDescs)
 Groups together sets of independent PxSolverConstraintDesc objects to be solved using SIMD SOA approach. More...
 
PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateContactConstraints (PxConstraintBatchHeader *batchHeader, const PxU32 nbHeaders, PxSolverContactDesc *contactDescs, PxConstraintAllocator &allocator, PxReal invDt, PxReal bounceThreshold, PxReal frictionOffsetThreshold, PxReal correlationDistance)
 Creates a set of contact constraint blocks. Note that, depending the results of PxBatchConstraints, each batchHeader may refer to up to 4 solverConstraintDescs. This function will allocate both constraint and friction patch data via the PxConstraintAllocator provided. Constraint data is only valid until PxSolveConstraints has completed. Friction data is to be retained and provided by the application for friction correlation. More...
 
PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateJointConstraints (PxConstraintBatchHeader *batchHeader, const PxU32 nbHeaders, PxSolverConstraintPrepDesc *jointDescs, PxConstraintAllocator &allocator, PxReal dt, PxReal invDt)
 Creates a set of joint constraint blocks. Note that, depending the results of PxBatchConstraints, the batchHeader may refer to up to 4 solverConstraintDescs. More...
 
PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateJointConstraintsWithShaders (PxConstraintBatchHeader *batchHeader, const PxU32 nbBatchHeaders, PxConstraint **constraints, PxSolverConstraintPrepDesc *jointDescs, PxConstraintAllocator &allocator, PxReal dt, PxReal invDt)
 Creates a set of joint constraint blocks. This function runs joint shaders defined inside PxConstraint** param, fills in joint row information in jointDescs and then calls PxCreateJointConstraints. More...
 
PX_C_EXPORT PX_PHYSX_CORE_API void PxSolveConstraints (PxConstraintBatchHeader *batchHeaders, const PxU32 nbBatchHeaders, PxSolverConstraintDesc *solverConstraintDescs, PxSolverBody *solverBodies, PxVec3 *linearMotionVelocity, PxVec3 *angularMotionVelocity, const PxU32 nbSolverBodies, const PxU32 nbPositionIterations, const PxU32 nbVelocityIterations)
 Iteratively solves the set of constraints defined by the provided PxConstraintBatchHeader and PxSolverConstraintDesc structures. Updates deltaVelocities inside the PxSolverBody structures. Produces resulting linear and angular motion velocities. More...
 
PX_C_EXPORT PX_PHYSX_CORE_API void PxIntegrateSolverBodies (PxSolverBodyData *solverBodyData, PxSolverBody *solverBody, const PxVec3 *linearMotionVelocity, const PxVec3 *angularMotionState, const PxU32 nbBodiesToIntegrate, PxReal dt)
 Integrates a rigid body, returning the new velocities and transforms. After this function has been called, solverBodyData stores all the body's velocity data. More...
 
PX_C_EXPORT PX_PHYSX_CORE_API bool PxGenerateContacts (const PxGeometry *const *geom0, const PxGeometry *const *geom1, const PxTransform *pose0, const PxTransform *pose1, PxCache *contactCache, const PxU32 nbPairs, PxContactRecorder &contactRecorder, const PxReal contactDistance, const PxReal meshContactMargin, const PxReal toleranceLength, PxCacheAllocator &allocator)
 

Detailed Description

Function Documentation

◆ PxBatchConstraints()

PX_C_EXPORT PX_PHYSX_CORE_API PxU32 PxBatchConstraints ( PxSolverConstraintDesc solverConstraintDescs,
const PxU32  nbConstraints,
PxSolverBody solverBodies,
PxU32  nbBodies,
PxConstraintBatchHeader outBatchHeaders,
PxSolverConstraintDesc outOrderedConstraintDescs 
)

Groups together sets of independent PxSolverConstraintDesc objects to be solved using SIMD SOA approach.

Parameters
[in]solverConstraintDescsthe set of solver constraint descs to batch
[in]nbConstraintsThe number of constraints to batch
[in,out]solverBodiesThe array of solver bodies that the constraints reference. Some fields in these structures are written to as scratch memory for the batching.
[in]nbBodiesThe number of bodies
[out]outBatchHeadersThe batch headers produced by this batching process. This array must have at least 1 entry per input constraint
[out]outOrderedConstraintDescsA reordered copy of the constraint descs. This array is referenced by the constraint batches. This array must have at least 1 entry per input constraint.
Returns
The total number of batches produced. This should be less than or equal to nbConstraints.
Note
This method considers all bodies within the range [0, nbBodies-1] to be valid dynamic bodies. A given dynamic body can only be referenced in a batch once. Static or kinematic bodies can be referenced multiple times within a batch safely because constraints do not affect their velocities. The batching will implicitly consider any bodies outside of the range [0, nbBodies-1] to be infinite mass (static or kinematic). This means that either appending static/kinematic to the end of the array of bodies or placing static/kinematic bodies at before the start body pointer will ensure that the minimum number of batches are produced.

◆ PxConstructSolverBodies()

PX_C_EXPORT PX_PHYSX_CORE_API void PxConstructSolverBodies ( const PxRigidBodyData inRigidData,
PxSolverBodyData outSolverBodyData,
const PxU32  nbBodies,
const PxVec3 gravity,
const PxReal  dt 
)

Constructs a PxSolverBodyData structure based on rigid body properties. Applies gravity, damping and clamps maximum velocity.

Parameters
[in]inRigidDataThe array rigid body properties
[out]outSolverBodyDataThe array of solverBodyData produced to repreent these bodies
[in]nbBodiesThe total number of solver bodies to create
[in]gravityThe gravity vector
[in]dtThe timestep

◆ PxConstructStaticSolverBody()

PX_C_EXPORT PX_PHYSX_CORE_API void PxConstructStaticSolverBody ( const PxTransform globalPose,
PxSolverBodyData solverBodyData 
)

Constructs a PxSolverBodyData structure for a static body at a given pose.

Parameters
[in]globalPoseThe pose of this static actor
[out]solverBodyDataThe solver body representation of this static actor

◆ PxCreateContactConstraints()

PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateContactConstraints ( PxConstraintBatchHeader batchHeader,
const PxU32  nbHeaders,
PxSolverContactDesc contactDescs,
PxConstraintAllocator allocator,
PxReal  invDt,
PxReal  bounceThreshold,
PxReal  frictionOffsetThreshold,
PxReal  correlationDistance 
)

Creates a set of contact constraint blocks. Note that, depending the results of PxBatchConstraints, each batchHeader may refer to up to 4 solverConstraintDescs. This function will allocate both constraint and friction patch data via the PxConstraintAllocator provided. Constraint data is only valid until PxSolveConstraints has completed. Friction data is to be retained and provided by the application for friction correlation.

Parameters
[in]batchHeaderArray of batch headers to process
[in]nbHeadersThe total number of headers
[in]contactDescsAn array of contact descs defining the pair and contact properties of each respective contacting pair
[in]allocatorAn allocator callback to allocate constraint and friction memory
[in]invDtThe inverse timestep
[in]bounceThresholdThe bounce threshold. Relative velocities below this will be solved by bias only. Relative velocities above this will be solved by restitution. If restitution is zero then these pairs will always be solved by bias.
[in]frictionOffsetThresholdThe friction offset threshold. Contacts whose separations are below this threshold can generate friction constraints.
[in]correlationDistanceThe correlation distance used by friction correlation to identify whether a friction patch is broken on the grounds of relation separation.
Returns
a boolean to define if this method was successful or not.

◆ PxCreateJointConstraints()

PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateJointConstraints ( PxConstraintBatchHeader batchHeader,
const PxU32  nbHeaders,
PxSolverConstraintPrepDesc jointDescs,
PxConstraintAllocator allocator,
PxReal  dt,
PxReal  invDt 
)

Creates a set of joint constraint blocks. Note that, depending the results of PxBatchConstraints, the batchHeader may refer to up to 4 solverConstraintDescs.

Parameters
[in]batchHeaderThe array of batch headers to be processed
[in]nbHeadersThe total number of batch headers to process
[in]jointDescsAn array of constraint prep descs defining the properties of the constraints being created
[in]allocatorAn allocator callback to allocate constraint data
[in]dtThe timestep
[in]invDtThe inverse timestep
Returns
a boolean indicating if this method was successful or not.

◆ PxCreateJointConstraintsWithShaders()

PX_C_EXPORT PX_PHYSX_CORE_API bool PxCreateJointConstraintsWithShaders ( PxConstraintBatchHeader batchHeader,
const PxU32  nbBatchHeaders,
PxConstraint **  constraints,
PxSolverConstraintPrepDesc jointDescs,
PxConstraintAllocator allocator,
PxReal  dt,
PxReal  invDt 
)

Creates a set of joint constraint blocks. This function runs joint shaders defined inside PxConstraint** param, fills in joint row information in jointDescs and then calls PxCreateJointConstraints.

Parameters
[in]batchHeaderThe set of batchHeaders to be processed
[in]nbBatchHeadersThe number of batch headers to process.
[in]constraintsThe set of constraints to be used to produce constraint rows
[in,out]jointDescsAn array of constraint prep descs defining the properties of the constraints being created
[in]allocatorAn allocator callback to allocate constraint data
[in]dtThe timestep
[in]invDtThe inverse timestep
Returns
a boolean indicating if this method was successful or not.

◆ PxGenerateContacts()

PX_C_EXPORT PX_PHYSX_CORE_API bool PxGenerateContacts ( const PxGeometry *const *  geom0,
const PxGeometry *const *  geom1,
const PxTransform pose0,
const PxTransform pose1,
PxCache contactCache,
const PxU32  nbPairs,
PxContactRecorder contactRecorder,
const PxReal  contactDistance,
const PxReal  meshContactMargin,
const PxReal  toleranceLength,
PxCacheAllocator allocator 
)

abrief Performs contact generation for a given pair of geometries at the specified poses. Produced contacts are stored in the provided Gu::ContactBuffer. Information is cached in PxCache structure to accelerate future contact generation between pairs. This cache data is valid only as long as the memory provided by PxCacheAllocator has not been released/re-used. Recommendation is to retain that data for a single simulation frame, discarding cached data after 2 frames. If the cached memory has been released/re-used prior to the corresponding pair having contact generation performed again, it is the application's responsibility to reset the PxCache.

Parameters
[in]geom0Array of geometries to perform collision detection on.
[in]geom1Array of geometries to perform collision detection on
[in]pose0Array of poses associated with the corresponding entry in the geom0 array
[in]pose1Array of poses associated with the corresponding entry in the geom1 array
[in,out]contactCacheArray of contact caches associated with each pair geom0[i] + geom1[i]
[in]nbPairsThe total number of pairs to process
[in]contactRecorderA callback that is called to record contacts for each pair that detects contacts
[in]contactDistanceThe distance at which contacts begin to be generated between the pairs
[in]meshContactMarginThe mesh contact margin.
[in]toleranceLengthThe toleranceLength. Used for scaling distance-based thresholds internally to produce appropriate results given simulations in different units
[in]allocatorA callback to allocate memory for the contact cache
Returns
a boolean indicating if the function was successful or not.

◆ PxIntegrateSolverBodies()

PX_C_EXPORT PX_PHYSX_CORE_API void PxIntegrateSolverBodies ( PxSolverBodyData solverBodyData,
PxSolverBody solverBody,
const PxVec3 linearMotionVelocity,
const PxVec3 angularMotionState,
const PxU32  nbBodiesToIntegrate,
PxReal  dt 
)

Integrates a rigid body, returning the new velocities and transforms. After this function has been called, solverBodyData stores all the body's velocity data.

Parameters
[in,out]solverBodyDataThe array of solver body data to be integrated
[in]solverBodyThe bodies' linear and angular velocities
[in]linearMotionVelocityThe bodies' linear motion velocity array
[in]angularMotionStateThe bodies' angular motion velocity array
[in]nbBodiesToIntegrateThe total number of bodies to integrate
[in]dtThe timestep

◆ PxSolveConstraints()

PX_C_EXPORT PX_PHYSX_CORE_API void PxSolveConstraints ( PxConstraintBatchHeader batchHeaders,
const PxU32  nbBatchHeaders,
PxSolverConstraintDesc solverConstraintDescs,
PxSolverBody solverBodies,
PxVec3 linearMotionVelocity,
PxVec3 angularMotionVelocity,
const PxU32  nbSolverBodies,
const PxU32  nbPositionIterations,
const PxU32  nbVelocityIterations 
)

Iteratively solves the set of constraints defined by the provided PxConstraintBatchHeader and PxSolverConstraintDesc structures. Updates deltaVelocities inside the PxSolverBody structures. Produces resulting linear and angular motion velocities.

Parameters
[in]batchHeadersThe set of batch headers to be solved
[in]nbBatchHeadersThe total number of batch headers to be solved
[in]solverConstraintDescsThe reordererd set of solver constraint descs referenced by the batch headers
[in,out]solverBodiesThe set of solver bodies the bodies reference
[out]linearMotionVelocityThe resulting linear motion velocity
[out]angularMotionVelocityThe resulting angular motion velocity.
[in]nbSolverBodiesThe total number of solver bodies
[in]nbPositionIterationsThe number of position iterations to run
[in]nbVelocityIterationsThe number of velocity iterations to run