PxLocationHit

Defined in include/geometry/PxGeometryHit.h

struct PxLocationHit : public PxQueryHit

Scene query hit information for raycasts and sweeps returning hit position and normal information.

PxHitFlag flags can be passed to scene query functions, as an optimization, to cause the SDK to only generate specific members of this structure.

Subclassed by PxGeomRaycastHit, PxGeomSweepHit

Public Functions

inline PxLocationHit()
inline bool hadInitialOverlap() const

Note

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

Note

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

Public Members

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.

Note

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

Note

Otherwise, this value will be >= 0

PxU32 faceIndex

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

Note

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

Note

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

Note

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

Note

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