Defined in include/geometry/PxGeometryHit.h

Inheritance Relationships

Base Type

Derived Type

struct PxGeomRaycastHit : public PxLocationHit

Stores results of raycast queries.

PxHitFlag flags can be passed to raycast function, as an optimization, to cause the SDK to only compute specified members of this structure.

Some members like barycentric coordinates are currently only computed for triangle meshes and height fields, but next versions might provide them in other cases. The client code should check flags to make sure returned values are valid.

See also


Subclassed by PxRaycastHit

Public Functions

inline PxGeomRaycastHit()
inline bool hadInitialOverlap() const


For raycast hits: true for shapes overlapping with raycast origin.


For sweep hits: true for shapes overlapping at zero sweep distance.

Public Members

PxReal u
PxReal v

barycentric coordinates of hit point, for triangle mesh and height field (flag: PxHitFlag::eUV)

PxHitFlags flags

Hit flags specifying which members contain valid values.

PxVec3 position

World-space hit position (flag: PxHitFlag::ePOSITION)

PxVec3 normal

World-space hit normal (flag: PxHitFlag::eNORMAL)

PxF32 distance

Distance to hit.


If the eMTD flag is used, distance will be a negative value if shapes are overlapping indicating the penetration depth.


Otherwise, this value will be >= 0

PxU32 faceIndex

Face index of touched triangle, for triangle meshes, convex meshes and height fields.


This index will default to 0xFFFFffff value for overlap queries.


Please refer to the user guide for more details for sweep queries.


This index is remapped by mesh cooking. Use PxTriangleMesh::getTrianglesRemap() to convert to original mesh index.


For convex meshes use PxConvexMesh::getPolygonData() to retrieve touched polygon data.