#ifndef PX_PHYSICS_EXTENSIONS_SHAPE_H
#define PX_PHYSICS_EXTENSIONS_SHAPE_H
#include "PxPhysXConfig.h"
#include "PxShape.h"
#include "PxRigidActor.h"
#include "geometry/PxGeometryQuery.h"
#if !PX_DOXYGEN
namespace physx
{
#endif
class PxShapeExt
{
public:
static PX_INLINE PxTransform getGlobalPose(const PxShape& shape, const PxRigidActor& actor)
{
return actor.getGlobalPose() * shape.getLocalPose();
}
static PX_INLINE PxU32 raycast(const PxShape& shape, const PxRigidActor& actor,
const PxVec3& rayOrigin, const PxVec3& rayDir, PxReal maxDist, PxHitFlags hitFlags,
PxU32 maxHits, PxRaycastHit* rayHits)
{
return PxGeometryQuery::raycast(
rayOrigin, rayDir, shape.getGeometry().any(), getGlobalPose(shape, actor), maxDist, hitFlags, maxHits, rayHits);
}
static PX_INLINE bool overlap(const PxShape& shape, const PxRigidActor& actor,
const PxGeometry& otherGeom, const PxTransform& otherGeomPose)
{
return PxGeometryQuery::overlap(shape.getGeometry().any(), getGlobalPose(shape, actor), otherGeom, otherGeomPose);
}
static PX_INLINE bool sweep(const PxShape& shape, const PxRigidActor& actor,
const PxVec3& unitDir, const PxReal distance, const PxGeometry& otherGeom, const PxTransform& otherGeomPose,
PxSweepHit& sweepHit, PxHitFlags hitFlags)
{
return PxGeometryQuery::sweep(unitDir, distance, otherGeom, otherGeomPose, shape.getGeometry().any(), getGlobalPose(shape, actor), sweepHit, hitFlags);
}
static PX_INLINE PxBounds3 getWorldBounds(const PxShape& shape, const PxRigidActor& actor, float inflation=1.01f)
{
return PxGeometryQuery::getWorldBounds(shape.getGeometry().any(), getGlobalPose(shape, actor), inflation);
}
};
#if !PX_DOXYGEN
} #endif
#endif