RavEngine
Loading...
Searching...
No Matches
physx::PxCustomGeometry::Callbacks Struct Referenceabstract

Custom geometry callbacks structure. User should inherit this and implement all pure virtual functions. More...

#include <PxCustomGeometry.h>

Inheritance diagram for physx::PxCustomGeometry::Callbacks:
[legend]

Public Member Functions

virtual Type getCustomType () const =0
 Return custom type. The type purpose is for user to differentiate custom geometries. Not used by PhysX.
 
virtual PxBounds3 getLocalBounds (const PxGeometry &geometry) const =0
 Return local bounds.
 
virtual bool generateContacts (const PxGeometry &geom0, const PxGeometry &geom1, const PxTransform &pose0, const PxTransform &pose1, const PxReal contactDistance, const PxReal meshContactMargin, const PxReal toleranceLength, PxContactBuffer &contactBuffer) const =0
 Contacts generation. Generate collision contacts between two geometries in given poses.
 
virtual PxU32 raycast (const PxVec3 &origin, const PxVec3 &unitDir, const PxGeometry &geom, const PxTransform &pose, PxReal maxDist, PxHitFlags hitFlags, PxU32 maxHits, PxGeomRaycastHit *rayHits, PxU32 stride, PxRaycastThreadContext *threadContext) const =0
 Raycast. Cast a ray against the geometry in given pose.
 
virtual bool overlap (const PxGeometry &geom0, const PxTransform &pose0, const PxGeometry &geom1, const PxTransform &pose1, PxOverlapThreadContext *threadContext) const =0
 Overlap. Test if geometries overlap.
 
virtual bool sweep (const PxVec3 &unitDir, const PxReal maxDist, const PxGeometry &geom0, const PxTransform &pose0, const PxGeometry &geom1, const PxTransform &pose1, PxGeomSweepHit &sweepHit, PxHitFlags hitFlags, const PxReal inflation, PxSweepThreadContext *threadContext) const =0
 Sweep. Sweep one geometry against the other.
 
virtual void visualize (const PxGeometry &geometry, PxRenderOutput &out, const PxTransform &absPose, const PxBounds3 &cullbox) const =0
 Visualize custom geometry for debugging. Optional.
 
virtual void computeMassProperties (const PxGeometry &geometry, PxMassProperties &massProperties) const =0
 Compute custom geometry mass properties. For geometries usable with dynamic rigidbodies.
 
virtual bool usePersistentContactManifold (const PxGeometry &geometry, PxReal &breakingThreshold) const =0
 Compatible with PhysX's PCM feature. Allows to optimize contact generation.
 

Detailed Description

Custom geometry callbacks structure. User should inherit this and implement all pure virtual functions.

Member Function Documentation

◆ computeMassProperties()

virtual void physx::PxCustomGeometry::Callbacks::computeMassProperties ( const PxGeometry &  geometry,
PxMassProperties &  massProperties 
) const
pure virtual

Compute custom geometry mass properties. For geometries usable with dynamic rigidbodies.

Parameters
[in]geometryThis geometry.
[out]massPropertiesMass properties to compute.

Implemented in VoxelMap, CustomCylinder, and CustomCone.

◆ generateContacts()

virtual bool physx::PxCustomGeometry::Callbacks::generateContacts ( const PxGeometry &  geom0,
const PxGeometry &  geom1,
const PxTransform &  pose0,
const PxTransform &  pose1,
const PxReal  contactDistance,
const PxReal  meshContactMargin,
const PxReal  toleranceLength,
PxContactBuffer &  contactBuffer 
) const
pure virtual

Contacts generation. Generate collision contacts between two geometries in given poses.

Parameters
[in]geom0This custom geometry
[in]geom1The other geometry
[in]pose0This custom geometry pose
[in]pose1The other geometry pose
[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
[out]contactBufferA buffer to write contacts to.
Returns
True if there are contacts. False otherwise.

Implemented in CustomConvex, and VoxelMap.

◆ getCustomType()

virtual Type physx::PxCustomGeometry::Callbacks::getCustomType ( ) const
pure virtual

Return custom type. The type purpose is for user to differentiate custom geometries. Not used by PhysX.

Returns
Unique ID of a custom geometry type.
Note
User should use DECLARE_CUSTOM_GEOMETRY_TYPE and IMPLEMENT_CUSTOM_GEOMETRY_TYPE intead of overwriting this function.

◆ getLocalBounds()

virtual PxBounds3 physx::PxCustomGeometry::Callbacks::getLocalBounds ( const PxGeometry &  geometry) const
pure virtual

Return local bounds.

Parameters
[in]geometryThis geometry.
Returns
Bounding box in the geometry local space.

Implemented in CustomConvex, and VoxelMap.

◆ overlap()

virtual bool physx::PxCustomGeometry::Callbacks::overlap ( const PxGeometry &  geom0,
const PxTransform &  pose0,
const PxGeometry &  geom1,
const PxTransform &  pose1,
PxOverlapThreadContext *  threadContext 
) const
pure virtual

Overlap. Test if geometries overlap.

Parameters
[in]geom0This custom geometry
[in]pose0This custom geometry pose
[in]geom1The other geometry
[in]pose1The other geometry pose
[in]threadContextOptional user-defined per-thread context.
Returns
True if there is overlap. False otherwise.

Implemented in CustomConvex, and VoxelMap.

◆ raycast()

virtual PxU32 physx::PxCustomGeometry::Callbacks::raycast ( const PxVec3 &  origin,
const PxVec3 &  unitDir,
const PxGeometry &  geom,
const PxTransform &  pose,
PxReal  maxDist,
PxHitFlags  hitFlags,
PxU32  maxHits,
PxGeomRaycastHit *  rayHits,
PxU32  stride,
PxRaycastThreadContext *  threadContext 
) const
pure virtual

Raycast. Cast a ray against the geometry in given pose.

Parameters
[in]originOrigin of the ray.
[in]unitDirNormalized direction of the ray.
[in]geomThis custom geometry
[in]poseThis custom geometry pose
[in]maxDistLength of the ray. Has to be in the [0, inf) range.
[in]hitFlagsSpecifies which properties per hit should be computed and returned via the hit callback.
[in]maxHitsmax number of returned hits = size of 'rayHits' buffer
[out]rayHitsRay hits.
[in]strideRay hit structure stride.
[in]threadContextOptional user-defined per-thread context.
Returns
Number of hits.

◆ sweep()

virtual bool physx::PxCustomGeometry::Callbacks::sweep ( const PxVec3 &  unitDir,
const PxReal  maxDist,
const PxGeometry &  geom0,
const PxTransform &  pose0,
const PxGeometry &  geom1,
const PxTransform &  pose1,
PxGeomSweepHit &  sweepHit,
PxHitFlags  hitFlags,
const PxReal  inflation,
PxSweepThreadContext *  threadContext 
) const
pure virtual

Sweep. Sweep one geometry against the other.

Parameters
[in]unitDirNormalized direction of the sweep.
[in]maxDistLength of the sweep. Has to be in the [0, inf) range.
[in]geom0This custom geometry
[in]pose0This custom geometry pose
[in]geom1The other geometry
[in]pose1The other geometry pose
[out]sweepHitUsed to report the sweep hit.
[in]hitFlagsSpecifies which properties per hit should be computed and returned via the hit callback.
[in]inflationThis parameter creates a skin around the swept geometry which increases its extents for sweeping.
[in]threadContextOptional user-defined per-thread context.
Returns
True if there is hit. False otherwise.

◆ usePersistentContactManifold()

virtual bool physx::PxCustomGeometry::Callbacks::usePersistentContactManifold ( const PxGeometry &  geometry,
PxReal &  breakingThreshold 
) const
pure virtual

Compatible with PhysX's PCM feature. Allows to optimize contact generation.

Parameters
[in]geometryThis geometry.
[out]breakingThresholdThe threshold to trigger contacts re-generation.

Implemented in CustomConvex, and VoxelMap.

◆ visualize()

virtual void physx::PxCustomGeometry::Callbacks::visualize ( const PxGeometry &  geometry,
PxRenderOutput &  out,
const PxTransform &  absPose,
const PxBounds3 &  cullbox 
) const
pure virtual

Visualize custom geometry for debugging. Optional.

Parameters
[in]geometryThis geometry.
[in]outRender output.
[in]absPoseGeometry absolute transform.
[in]cullboxRegion to visualize.

Implemented in CustomConvex, and VoxelMap.


The documentation for this struct was generated from the following file: