14template <
class Vec,
class Mat,
class ShapeCastType>
31 ShapeCastT<Vec, Mat, ShapeCastType>(inShape, inScale, inCenterOfMassStart, inDirection, inShape->GetWorldSpaceBounds(inCenterOfMassStart, inScale))
38 return ShapeCastType(inShape, inScale, inWorldTransform.PreTranslated(inShape->
GetCenterOfMass()), inDirection);
128 CollideShapeResult(inContactPoint1, inContactPoint2, inContactNormalOrPenetrationDepth, (inContactPoint2 - inContactPoint1).Length(), inSubShapeID1, inSubShapeID2, inBodyID2),
EBackFaceMode
How collision detection functions will treat back facing triangles.
Definition: BackFaceMode.h:11
#define JPH_NAMESPACE_END
Definition: Core.h:378
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:372
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:31
Mat44 RMat44
Definition: Real.h:31
Vec3 RVec3
Definition: Real.h:29
Axis aligned box.
Definition: AABox.h:16
ID of a body. This is a way of reasoning about bodies in a multithreaded simulation while avoiding ra...
Definition: BodyID.h:13
Settings to be passed with a collision query.
Definition: CollideShape.h:72
Class that contains all information of two colliding shapes.
Definition: CollideShape.h:19
SubShapeID mSubShapeID1
Sub shape ID that identifies the face on shape 1.
Definition: CollideShape.h:63
BodyID mBodyID2
BodyID to which shape 2 belongs to.
Definition: CollideShape.h:65
Vec3 mContactPointOn2
Contact point on the surface of shape 2 (in world space or relative to base offset)....
Definition: CollideShape.h:60
Vec3 mPenetrationAxis
Direction to move shape 2 out of collision along the shortest path (magnitude is meaningless,...
Definition: CollideShape.h:61
Vec3 mContactPointOn1
Contact point on the surface of shape 1 (in world space or relative to base offset)
Definition: CollideShape.h:59
float mPenetrationDepth
Penetration depth (move shape 2 by this distance to resolve the collision)
Definition: CollideShape.h:62
Face mShape1Face
Colliding face on shape 1 (optional result, in world space or relative to base offset)
Definition: CollideShape.h:66
SubShapeID mSubShapeID2
Sub shape ID that identifies the face on shape 2.
Definition: CollideShape.h:64
Face mShape2Face
Colliding face on shape 2 (optional result, in world space or relative to base offset)
Definition: CollideShape.h:67
Holds a 4x4 matrix of floats, but supports also operations on the 3x3 upper left part of the matrix.
Definition: Mat44.h:13
JPH_INLINE Mat44 ToMat44() const
In single precision mode just return the matrix itself.
Definition: Mat44.h:225
Result of a shape cast test.
Definition: ShapeCast.h:111
float GetEarlyOutFraction() const
Function required by the CollisionCollector. A smaller fraction is considered to be a 'better hit'....
Definition: ShapeCast.h:135
bool mIsBackFaceHit
True if the shape was hit from the back side.
Definition: ShapeCast.h:167
JPH_OVERRIDE_NEW_DELETE ShapeCastResult()=default
Default constructor.
float mFraction
This is the fraction where the shape hit the other shape: CenterOfMassOnHit = Start + value * (End - ...
Definition: ShapeCast.h:166
ShapeCastResult Reversed(Vec3Arg inWorldSpaceCastDirection) const
Definition: ShapeCast.h:139
ShapeCastResult(float inFraction, Vec3Arg inContactPoint1, Vec3Arg inContactPoint2, Vec3Arg inContactNormalOrPenetrationDepth, bool inBackFaceHit, const SubShapeID &inSubShapeID1, const SubShapeID &inSubShapeID2, const BodyID &inBodyID2)
Definition: ShapeCast.h:127
Settings to be passed with a shape cast.
Definition: ShapeCast.h:92
JPH_OVERRIDE_NEW_DELETE EBackFaceMode mBackFaceModeTriangles
How backfacing triangles should be treated (should we report moving out of a triangle?...
Definition: ShapeCast.h:97
bool mReturnDeepestPoint
When true, and the shape is intersecting at the beginning of the cast (fraction = 0) then this will c...
Definition: ShapeCast.h:106
EBackFaceMode mBackFaceModeConvex
How backfacing convex objects should be treated (should we report starting inside an object and movin...
Definition: ShapeCast.h:100
bool mUseShrunkenShapeAndConvexRadius
Indicates if we want to shrink the shape by the convex radius and then expand it again....
Definition: ShapeCast.h:103
Base class for all shapes (collision volume of a body). Defines a virtual interface for collision det...
Definition: Shape.h:178
virtual Vec3 GetCenterOfMass() const
All shapes are centered around their center of mass. This function returns the center of mass positio...
Definition: Shape.h:203
uint size_type
Definition: StaticArray.h:18
size_type size() const
Returns amount of elements in the array.
Definition: StaticArray.h:89
void resize(size_type inNewSize)
Resize array to new length.
Definition: StaticArray.h:101
A sub shape id contains a path to an element (usually a triangle or other primitive type) of a compou...
Definition: SubShapeID.h:23
Definition: ShapeCast.h:74
RShapeCast(const ShapeCast &inCast)
Convert from ShapeCast, converts single to double precision.
Definition: ShapeCast.h:78
Definition: ShapeCast.h:69
Structure that holds a single shape cast (a shape moving along a linear path in 3d space with no rota...
Definition: ShapeCast.h:16
static ShapeCastType sFromWorldTransform(const Shape *inShape, Vec3Arg inScale, typename Mat::ArgType inWorldTransform, Vec3Arg inDirection)
Construct a shape cast using a world transform for a shape instead of a center of mass transform.
Definition: ShapeCast.h:36
ShapeCastType PostTranslated(typename Vec::ArgType inTranslation) const
Translate this shape cast by inTranslation.
Definition: ShapeCast.h:50
JPH_OVERRIDE_NEW_DELETE ShapeCastT(const Shape *inShape, Vec3Arg inScale, typename Mat::ArgType inCenterOfMassStart, Vec3Arg inDirection, const AABox &inWorldSpaceBounds)
Constructor.
Definition: ShapeCast.h:20
const Vec3 mDirection
Direction and length of the cast (anything beyond this length will not be reported as a hit)
Definition: ShapeCast.h:64
const Shape * mShape
Shape that's being cast (cannot be mesh shape). Note that this structure does not assume ownership ov...
Definition: ShapeCast.h:61
ShapeCastT(const Shape *inShape, Vec3Arg inScale, typename Mat::ArgType inCenterOfMassStart, Vec3Arg inDirection)
Constructor.
Definition: ShapeCast.h:30
Vec GetPointOnRay(float inFraction) const
Get point with fraction inFraction on ray from mCenterOfMassStart to mCenterOfMassStart + mDirection ...
Definition: ShapeCast.h:56
ShapeCastType PostTransformed(typename Mat::ArgType inTransform) const
Transform this shape cast using inTransform. Multiply transform on the left left hand side.
Definition: ShapeCast.h:42
const Mat mCenterOfMassStart
Start position and orientation of the center of mass of the shape (construct using sFromWorldTransfor...
Definition: ShapeCast.h:63
const Vec3 mScale
Scale in local space of the shape being cast (scales relative to its center of mass)
Definition: ShapeCast.h:62
const AABox mShapeWorldBounds
Cached shape's world bounds, calculated in constructor.
Definition: ShapeCast.h:65