PxGjkQueryExt

Defined in include/extensions/PxGjkQueryExt.h

class PxGjkQueryExt

Pre-made support mapping for built-in convex geometry types.

Public Static Functions

static bool generateContacts(const PxGjkQuery::Support &a, const PxGjkQuery::Support &b, const PxTransform &poseA, const PxTransform &poseB, PxReal contactDistance, PxReal toleranceLength, PxContactBuffer &contactBuffer)

Generates a contact point between two shapes using GJK-EPA algorithm.

Parameters
  • a[in] Shape A support mapping

  • b[in] Shape B support mapping

  • poseA[in] Shape A transformation

  • poseB[in] Shape B transformation

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

  • 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 store the contact

Returns

True if there is a contact.

struct BoxSupport : public PxGjkQuery::Support

Pre-made support mapping for a box.

Public Functions

BoxSupport()

Default constructor.

BoxSupport(const PxVec3 &halfExtents, PxReal margin = 0)

Constructs a BoxSupport for a box halfExtents with optional margin.

BoxSupport(const PxBoxGeometry &box, PxReal margin = 0)

Constructs a BoxSupport for a PxBoxGeometry.

virtual PxReal getMargin() const

Return the user defined shape margin.

Margin should be greater than or equal to 0

Returns

Margin.

virtual PxVec3 supportLocal(const PxVec3 &dir) const

Return the farthest point on the user defined shape’s core in given direction.

Parameters

dir[in] Direction

Returns

Farthest point in given direction.

Public Members

PxVec3 halfExtents
PxReal margin
struct CapsuleSupport : public PxGjkQuery::Support

Pre-made support mapping for a capsule.

Public Functions

CapsuleSupport()

Default constructor.

CapsuleSupport(PxReal radius, PxReal halfHeight)

Constructs a CapsuleSupport for capsule radius and halfHeight.

CapsuleSupport(const PxCapsuleGeometry &geom)

Constructs a CapsuleSupport for a PxCapsuleGeometry.

virtual PxReal getMargin() const

Return the user defined shape margin.

Margin should be greater than or equal to 0

Returns

Margin.

virtual PxVec3 supportLocal(const PxVec3 &dir) const

Return the farthest point on the user defined shape’s core in given direction.

Parameters

dir[in] Direction

Returns

Farthest point in given direction.

Public Members

PxReal radius
PxReal halfHeight
struct ConvexGeomSupport : public PxGjkQuery::Support

Pre-made support mapping for any PhysX’s convex geometry (sphere, capsule, box, convex mesh)

Public Functions

ConvexGeomSupport()

Default constructor.

ConvexGeomSupport(const PxGeometry &geom, PxReal margin = 0)

Constructs a BoxSupport for a PxGeometry.

~ConvexGeomSupport()

Destructor.

bool isValid() const

Returns false if ConvexGeomSupport was constructed from non-convex geometry.

virtual PxReal getMargin() const

Return the user defined shape margin.

Margin should be greater than or equal to 0

Returns

Margin.

virtual PxVec3 supportLocal(const PxVec3 &dir) const

Return the farthest point on the user defined shape’s core in given direction.

Parameters

dir[in] Direction

Returns

Farthest point in given direction.

Public Members

void *alignment
PxU8 sphere[sizeof(SphereSupport)]
PxU8 capsule[sizeof(CapsuleSupport)]
PxU8 box[sizeof(BoxSupport)]
PxU8 convexMesh[sizeof(ConvexMeshSupport)]
struct ConvexMeshSupport : public PxGjkQuery::Support

Pre-made support mapping for a convex mesh.

Public Functions

ConvexMeshSupport()

Default constructor.

ConvexMeshSupport(const PxConvexMesh &convexMesh, const PxVec3 &scale = PxVec3(1), const PxQuat &scaleRotation = PxQuat(PxIdentity), PxReal margin = 0)

Constructs a BoxSupport for a PxConvexMesh.

ConvexMeshSupport(const PxConvexMeshGeometry &convexMesh, PxReal margin = 0)

Constructs a BoxSupport for a PxConvexMeshGeometry.

virtual PxReal getMargin() const

Return the user defined shape margin.

Margin should be greater than or equal to 0

Returns

Margin.

virtual PxVec3 supportLocal(const PxVec3 &dir) const

Return the farthest point on the user defined shape’s core in given direction.

Parameters

dir[in] Direction

Returns

Farthest point in given direction.

Public Members

const PxConvexMesh *convexMesh
PxVec3 scale
PxQuat scaleRotation
PxReal margin
struct SphereSupport : public PxGjkQuery::Support

Pre-made support mapping for a sphere.

Public Functions

SphereSupport()

Default constructor.

SphereSupport(PxReal radius)

Constructs a SphereSupport for a sphere radius.

SphereSupport(const PxSphereGeometry &geom)

Constructs a SphereSupport for a PxSphereGeometry.

virtual PxReal getMargin() const

Return the user defined shape margin.

Margin should be greater than or equal to 0

Returns

Margin.

virtual PxVec3 supportLocal(const PxVec3 &dir) const

Return the farthest point on the user defined shape’s core in given direction.

Parameters

dir[in] Direction

Returns

Farthest point in given direction.

Public Members

PxReal radius