PxBatchConstraints

Defined in include/PxImmediateMode.h

PxU32 PxBatchConstraints(const PxSolverConstraintDesc *solverConstraintDescs, PxU32 nbConstraints, PxSolverBody *solverBodies, PxU32 nbBodies, PxConstraintBatchHeader *outBatchHeaders, PxSolverConstraintDesc *outOrderedConstraintDescs, PxArticulationHandle *articulations = NULL, PxU32 nbArticulations = 0)

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

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.

Parameters
  • solverConstraintDescs[in] The set of solver constraint descs to batch

  • nbConstraints[in] The number of constraints to batch

  • solverBodies[inout] The array of solver bodies that the constraints reference. Some fields in these structures are written to as scratch memory for the batching.

  • nbBodies[in] The number of bodies

  • outBatchHeaders[out] The batch headers produced by this batching process. This array must have at least 1 entry per input constraint

  • outOrderedConstraintDescs[out] 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.

  • articulations[inout] The array of articulations that the constraints reference. Some fields in these structures are written to as scratch memory for the batching.

  • nbArticulations[in] The number of articulations

Returns

The total number of batches produced. This should be less than or equal to nbConstraints.