Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
CollideShapeResult Class Reference

Class that contains all information of two colliding shapes. More...

#include <CollideShape.h>

Inheritance diagram for CollideShapeResult:
ShapeCastResult

Public Types

using Face = StaticArray< Vec3, 32 >
 

Public Member Functions

JPH_OVERRIDE_NEW_DELETE CollideShapeResult ()=default
 Default constructor.
 
 CollideShapeResult (Vec3Arg inContactPointOn1, Vec3Arg inContactPointOn2, Vec3Arg inPenetrationAxis, float inPenetrationDepth, const SubShapeID &inSubShapeID1, const SubShapeID &inSubShapeID2, const BodyID &inBodyID2)
 Constructor.
 
float GetEarlyOutFraction () const
 Function required by the CollisionCollector. A smaller fraction is considered to be a 'better hit'. We use -penetration depth to get the hit with the biggest penetration depth.
 
CollideShapeResult Reversed () const
 Reverses the hit result, swapping contact point 1 with contact point 2 etc.
 

Public Attributes

Vec3 mContactPointOn1
 Contact point on the surface of shape 1 (in world space or relative to base offset)
 
Vec3 mContactPointOn2
 Contact point on the surface of shape 2 (in world space or relative to base offset). If the penetration depth is 0, this will be the same as mContactPointOn1.
 
Vec3 mPenetrationAxis
 Direction to move shape 2 out of collision along the shortest path (magnitude is meaningless, in world space). You can use -mPenetrationAxis.Normalized() as contact normal.
 
float mPenetrationDepth
 Penetration depth (move shape 2 by this distance to resolve the collision)
 
SubShapeID mSubShapeID1
 Sub shape ID that identifies the face on shape 1.
 
SubShapeID mSubShapeID2
 Sub shape ID that identifies the face on shape 2.
 
BodyID mBodyID2
 BodyID to which shape 2 belongs to.
 
Face mShape1Face
 Colliding face on shape 1 (optional result, in world space or relative to base offset)
 
Face mShape2Face
 Colliding face on shape 2 (optional result, in world space or relative to base offset)
 

Detailed Description

Class that contains all information of two colliding shapes.

Member Typedef Documentation

◆ Face

Constructor & Destructor Documentation

◆ CollideShapeResult() [1/2]

JPH_OVERRIDE_NEW_DELETE CollideShapeResult::CollideShapeResult ( )
default

Default constructor.

◆ CollideShapeResult() [2/2]

CollideShapeResult::CollideShapeResult ( Vec3Arg  inContactPointOn1,
Vec3Arg  inContactPointOn2,
Vec3Arg  inPenetrationAxis,
float  inPenetrationDepth,
const SubShapeID inSubShapeID1,
const SubShapeID inSubShapeID2,
const BodyID inBodyID2 
)
inline

Constructor.

Member Function Documentation

◆ GetEarlyOutFraction()

float CollideShapeResult::GetEarlyOutFraction ( ) const
inline

Function required by the CollisionCollector. A smaller fraction is considered to be a 'better hit'. We use -penetration depth to get the hit with the biggest penetration depth.

◆ Reversed()

CollideShapeResult CollideShapeResult::Reversed ( ) const
inline

Reverses the hit result, swapping contact point 1 with contact point 2 etc.

Member Data Documentation

◆ mBodyID2

BodyID CollideShapeResult::mBodyID2

BodyID to which shape 2 belongs to.

◆ mContactPointOn1

Vec3 CollideShapeResult::mContactPointOn1

Contact point on the surface of shape 1 (in world space or relative to base offset)

◆ mContactPointOn2

Vec3 CollideShapeResult::mContactPointOn2

Contact point on the surface of shape 2 (in world space or relative to base offset). If the penetration depth is 0, this will be the same as mContactPointOn1.

◆ mPenetrationAxis

Vec3 CollideShapeResult::mPenetrationAxis

Direction to move shape 2 out of collision along the shortest path (magnitude is meaningless, in world space). You can use -mPenetrationAxis.Normalized() as contact normal.

◆ mPenetrationDepth

float CollideShapeResult::mPenetrationDepth

Penetration depth (move shape 2 by this distance to resolve the collision)

◆ mShape1Face

Face CollideShapeResult::mShape1Face

Colliding face on shape 1 (optional result, in world space or relative to base offset)

◆ mShape2Face

Face CollideShapeResult::mShape2Face

Colliding face on shape 2 (optional result, in world space or relative to base offset)

◆ mSubShapeID1

SubShapeID CollideShapeResult::mSubShapeID1

Sub shape ID that identifies the face on shape 1.

◆ mSubShapeID2

SubShapeID CollideShapeResult::mSubShapeID2

Sub shape ID that identifies the face on shape 2.


The documentation for this class was generated from the following file: