PxGenerateContacts

Defined in include/PxImmediateMode.h

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

Performs contact generation for a given pair of geometries at the specified poses.

Produced contacts are stored in the provided contact recorder. 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
  • geom0[in] Array of geometries to perform collision detection on.

  • geom1[in] Array of geometries to perform collision detection on

  • pose0[in] Array of poses associated with the corresponding entry in the geom0 array

  • pose1[in] Array of poses associated with the corresponding entry in the geom1 array

  • contactCache[inout] Array of contact caches associated with each pair geom0[i] + geom1[i]

  • nbPairs[in] The total number of pairs to process

  • contactRecorder[out] A callback that is called to record contacts for each pair that detects contacts

  • contactDistance[in] The distance at which contacts begin to be generated between the pairs

  • meshContactMargin[in] The mesh contact margin.

  • toleranceLength[in] The toleranceLength. Used for scaling distance-based thresholds internally to produce appropriate results given simulations in different units

  • allocator[in] A callback to allocate memory for the contact cache

Returns

a boolean indicating if the function was successful or not.