Function physx_sys::PxMeshQuery_sweep
source · pub unsafe extern "C" fn PxMeshQuery_sweep(
unitDir: *const PxVec3,
distance: f32,
geom: *const PxGeometry,
pose: *const PxTransform,
triangleCount: u32,
triangles: *const PxTriangle,
sweepHit: *mut PxGeomSweepHit,
hitFlags: PxHitFlags,
cachedIndex: *const u32,
inflation: f32,
doubleSided: bool,
queryFlags: PxGeometryQueryFlags
) -> bool
Expand description
Sweep a specified geometry object in space and test for collision with a set of given triangles.
This function simply sweeps input geometry against each input triangle, in the order they are given. This is an O(N) operation with N = number of input triangles. It does not use any particular acceleration structure.
True if the swept geometry object hits the specified triangles
Only the following geometry types are currently supported: PxSphereGeometry, PxCapsuleGeometry, PxBoxGeometry
If a shape from the scene is already overlapping with the query shape in its starting position, the hit is returned unless eASSUME_NO_INITIAL_OVERLAP was specified.
This function returns a single closest hit across all the input triangles. Multiple hits are not supported.
Supported hitFlags are PxHitFlag::eDEFAULT, PxHitFlag::eASSUME_NO_INITIAL_OVERLAP, PxHitFlag::ePRECISE_SWEEP, PxHitFlag::eMESH_BOTH_SIDES, PxHitFlag::eMESH_ANY.
ePOSITION is only defined when there is no initial overlap (sweepHit.hadInitialOverlap() == false)
The returned normal for initially overlapping sweeps is set to -unitDir.
Otherwise the returned normal is the front normal of the triangle even if PxHitFlag::eMESH_BOTH_SIDES is set.
The returned PxGeomSweepHit::faceIndex parameter will hold the index of the hit triangle in input array, i.e. the range is [0; triangleCount). For initially overlapping sweeps, this is the index of overlapping triangle.
The inflation parameter is not compatible with PxHitFlag::ePRECISE_SWEEP.