PxCustomGeometry#
Defined in include/geometry/PxCustomGeometry.h
Structs#
-
class PxCustomGeometry : public PxGeometry#
Custom geometry class.
This class allows user to create custom geometries by providing a set of virtual callback functions.
Public Functions
-
inline PxCustomGeometry()#
Default constructor.
Creates an empty object with a NULL callbacks pointer.
-
inline PxCustomGeometry(const PxCustomGeometry &that)#
Copy constructor.
- Parameters:
that – [in] Other object
-
inline void operator=(const PxCustomGeometry &that)#
Assignment operator.
-
inline bool isValid() const#
Returns true if the geometry is valid.
See also
- Returns:
True if the current settings are valid for shape creation.
-
inline PxGeometryType::Enum getType() const#
Returns the type of the geometry.
- Returns:
The type of the object.
Protected Attributes
-
PxGeometryType::Enum mType#
-
struct Callbacks#
Custom geometry callbacks structure.
User should inherit this and implement all pure virtual functions.
Public Functions
-
virtual Type getCustomType() const = 0#
Return custom type.
The type purpose is for user to differentiate custom geometries. Not used by PhysX.
Note
User should use DECLARE_CUSTOM_GEOMETRY_TYPE and IMPLEMENT_CUSTOM_GEOMETRY_TYPE intead of overwriting this function.
- Returns:
Unique ID of a custom geometry type.
-
virtual PxBounds3 getLocalBounds(const PxGeometry &geometry) const = 0#
Return local bounds.
- Parameters:
geometry – [in] This geometry.
- Returns:
Bounding box in the geometry local space.
- 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,
Contacts generation.
Generate collision contacts between two geometries in given poses.
- Parameters:
geom0 – [in] This custom geometry
geom1 – [in] The other geometry
pose0 – [in] This custom geometry pose
pose1 – [in] The other geometry pose
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
contactBuffer – [out] A buffer to write contacts to.
- Returns:
True if there are contacts. False otherwise.
- 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,
Raycast.
Cast a ray against the geometry in given pose.
- Parameters:
origin – [in] Origin of the ray.
unitDir – [in] Normalized direction of the ray.
geom – [in] This custom geometry
pose – [in] This custom geometry pose
maxDist – [in] Length of the ray. Has to be in the [0, inf) range.
hitFlags – [in] Specifies which properties per hit should be computed and returned via the hit callback.
maxHits – [in] max number of returned hits = size of ‘rayHits’ buffer
rayHits – [out] Ray hits.
stride – [in] Ray hit structure stride.
threadContext – [in] Optional user-defined per-thread context.
- Returns:
Number of hits.
- virtual bool overlap(
- const PxGeometry &geom0,
- const PxTransform &pose0,
- const PxGeometry &geom1,
- const PxTransform &pose1,
- PxOverlapThreadContext *threadContext,
Overlap.
Test if geometries overlap.
- Parameters:
geom0 – [in] This custom geometry
pose0 – [in] This custom geometry pose
geom1 – [in] The other geometry
pose1 – [in] The other geometry pose
threadContext – [in] Optional user-defined per-thread context.
- Returns:
True if there is overlap. False otherwise.
- 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,
Sweep.
Sweep geom1 against geom0.
- Parameters:
unitDir – [in] Normalized direction of the sweep. geom1 is swept along this direction.
maxDist – [in] Length of the sweep. Has to be in the [0, inf) range.
geom0 – [in] This custom geometry
pose0 – [in] This custom geometry pose
geom1 – [in] The other geometry
pose1 – [in] The other geometry pose
sweepHit – [out] Used to report the sweep hit.
hitFlags – [in] Specifies which properties per hit should be computed and returned via the hit callback.
inflation – [in] This parameter creates a skin around the swept geometry which increases its extents for sweeping.
threadContext – [in] Optional user-defined per-thread context.
- Returns:
True if there is hit. False otherwise.
- virtual void visualize(
- const PxGeometry &geometry,
- PxRenderOutput &out,
- const PxTransform &absPose,
- const PxBounds3 &cullbox,
Visualize custom geometry for debugging.
Optional.
- Parameters:
geometry – [in] This geometry.
out – [in] Render output.
absPose – [in] Geometry absolute transform.
cullbox – [in] Region to visualize.
- virtual void computeMassProperties(
- const PxGeometry &geometry,
- PxMassProperties &massProperties,
Compute custom geometry mass properties.
For geometries usable with dynamic rigidbodies.
- Parameters:
geometry – [in] This geometry.
massProperties – [out] Mass properties to compute.
- virtual bool usePersistentContactManifold(
- const PxGeometry &geometry,
- PxReal &breakingThreshold,
Compatible with PhysX’s PCM feature.
Allows to optimize contact generation.
- Parameters:
geometry – [in] This geometry.
breakingThreshold – [out] The threshold to trigger contacts re-generation.
-
inline virtual ~Callbacks()#
-
virtual Type getCustomType() const = 0#
-
inline PxCustomGeometry()#