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.
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.
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.
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.
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.
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.
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.
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.
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)

Function Documentation

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] solverConstraintDescs the set of solver constraint descs to batch
[in] nbConstraints The number of constraints to batch
[in,out] solverBodies The array of solver bodies that the constraints reference. Some fields in these structures are written to as scratch memory for the batching.
[in] nbBodies The number of bodies
[out] outBatchHeaders The batch headers produced by this batching process. This array must have at least 1 entry per input constraint
[out] outOrderedConstraintDescs A 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.

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] inRigidData The array rigid body properties
[out] outSolverBodyData The array of solverBodyData produced to repreent these bodies
[in] nbBodies The total number of solver bodies to create
[in] gravity The gravity vector
[in] dt The timestep

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] globalPose The pose of this static actor
[out] solverBodyData The solver body representation of this static actor

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] batchHeader Array of batch headers to process
[in] nbHeaders The total number of headers
[in] contactDescs An array of contact descs defining the pair and contact properties of each respective contacting pair
[in] allocator An allocator callback to allocate constraint and friction memory
[in] invDt The inverse timestep
[in] bounceThreshold The 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] frictionOffsetThreshold The friction offset threshold. Contacts whose separations are below this threshold can generate friction constraints.
[in] correlationDistance The 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.

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] batchHeader The array of batch headers to be processed
[in] nbHeaders The total number of batch headers to process
[in] jointDescs An array of constraint prep descs defining the properties of the constraints being created
[in] allocator An allocator callback to allocate constraint data
[in] dt The timestep
[in] invDt The inverse timestep
Returns:
a boolean indicating if this method was successful or not.

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] batchHeader The set of batchHeaders to be processed
[in] nbBatchHeaders The number of batch headers to process.
[in] constraints The set of constraints to be used to produce constraint rows
[in,out] jointDescs An array of constraint prep descs defining the properties of the constraints being created
[in] allocator An allocator callback to allocate constraint data
[in] dt The timestep
[in] invDt The inverse timestep
Returns:
a boolean indicating if this method was successful or not.

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] geom0 Array of geometries to perform collision detection on.
[in] geom1 Array of geometries to perform collision detection on
[in] pose0 Array of poses associated with the corresponding entry in the geom0 array
[in] pose1 Array of poses associated with the corresponding entry in the geom1 array
[in,out] contactCache Array of contact caches associated with each pair geom0[i] + geom1[i]
[in] nbPairs The total number of pairs to process
[in] contactRecorder A callback that is called to record contacts for each pair that detects contacts
[in] contactDistance The distance at which contacts begin to be generated between the pairs
[in] meshContactMargin The mesh contact margin.
[in] toleranceLength The toleranceLength. Used for scaling distance-based thresholds internally to produce appropriate results given simulations in different units
[in] allocator A callback to allocate memory for the contact cache
Returns:
a boolean indicating if the function was successful or not.

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] solverBodyData The array of solver body data to be integrated
[in] solverBody The bodies' linear and angular velocities
[in] linearMotionVelocity The bodies' linear motion velocity array
[in] angularMotionState The bodies' angular motion velocity array
[in] nbBodiesToIntegrate The total number of bodies to integrate
[in] dt The timestep

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] batchHeaders The set of batch headers to be solved
[in] nbBatchHeaders The total number of batch headers to be solved
[in] solverConstraintDescs The reordererd set of solver constraint descs referenced by the batch headers
[in,out] solverBodies The set of solver bodies the bodies reference
[out] linearMotionVelocity The resulting linear motion velocity
[out] angularMotionVelocity The resulting angular motion velocity.
[in] nbSolverBodies The total number of solver bodies
[in] nbPositionIterations The number of position iterations to run
[in] nbVelocityIterations The number of velocity iterations to run



Copyright © 2008-2018 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com