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

Dispatch function, main function to handle collisions between shapes. More...

#include <CollisionDispatch.h>

Public Types

using CollideShape = void(*)(const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, const ShapeFilter &inShapeFilter)
 Function that collides 2 shapes (see sCollideShapeVsShape)
 
using CastShape = void(*)(const ShapeCast &inShapeCast, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)
 Function that casts a shape vs another shape (see sCastShapeVsShapeLocalSpace)
 

Static Public Member Functions

static void sCollideShapeVsShape (const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, const ShapeFilter &inShapeFilter={ })
 
static void sCastShapeVsShapeLocalSpace (const ShapeCast &inShapeCastLocal, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)
 
static void sCastShapeVsShapeWorldSpace (const ShapeCast &inShapeCastWorld, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)
 
static void sInit ()
 Initialize all collision functions with a function that asserts and returns no collision.
 
static void sRegisterCollideShape (EShapeSubType inType1, EShapeSubType inType2, CollideShape inFunction)
 Register a collide shape function in the collision table.
 
static void sRegisterCastShape (EShapeSubType inType1, EShapeSubType inType2, CastShape inFunction)
 Register a cast shape function in the collision table.
 
static void sReversedCollideShape (const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, const ShapeFilter &inShapeFilter)
 An implementation of CollideShape that swaps inShape1 and inShape2 and swaps the result back, can be registered if the collision function only exists the other way around.
 
static void sReversedCastShape (const ShapeCast &inShapeCast, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)
 An implementation of CastShape that swaps inShape1 and inShape2 and swaps the result back, can be registered if the collision function only exists the other way around.
 

Detailed Description

Dispatch function, main function to handle collisions between shapes.

Member Typedef Documentation

◆ CastShape

using CollisionDispatch::CastShape = void (*)(const ShapeCast &inShapeCast, const ShapeCastSettings &inShapeCastSettings, const Shape *inShape, Vec3Arg inScale, const ShapeFilter &inShapeFilter, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, CastShapeCollector &ioCollector)

Function that casts a shape vs another shape (see sCastShapeVsShapeLocalSpace)

◆ CollideShape

using CollisionDispatch::CollideShape = void (*)(const Shape *inShape1, const Shape *inShape2, Vec3Arg inScale1, Vec3Arg inScale2, Mat44Arg inCenterOfMassTransform1, Mat44Arg inCenterOfMassTransform2, const SubShapeIDCreator &inSubShapeIDCreator1, const SubShapeIDCreator &inSubShapeIDCreator2, const CollideShapeSettings &inCollideShapeSettings, CollideShapeCollector &ioCollector, const ShapeFilter &inShapeFilter)

Function that collides 2 shapes (see sCollideShapeVsShape)

Member Function Documentation

◆ sCastShapeVsShapeLocalSpace()

static void CollisionDispatch::sCastShapeVsShapeLocalSpace ( const ShapeCast inShapeCastLocal,
const ShapeCastSettings inShapeCastSettings,
const Shape inShape,
Vec3Arg  inScale,
const ShapeFilter inShapeFilter,
Mat44Arg  inCenterOfMassTransform2,
const SubShapeIDCreator inSubShapeIDCreator1,
const SubShapeIDCreator inSubShapeIDCreator2,
CastShapeCollector ioCollector 
)
inlinestatic

Cast a shape against this shape, passes any hits found to ioCollector. Note: This version takes the shape cast in local space relative to the center of mass of inShape, take a look at sCastShapeVsShapeWorldSpace if you have a shape cast in world space.

Parameters
inShapeCastLocalThe shape to cast against the other shape and its start and direction.
inShapeCastSettingsSettings for performing the cast
inShapeThe shape to cast against.
inScaleLocal space scale for the shape to cast against (scales relative to its center of mass).
inShapeFilterallows selectively disabling collisions between pairs of (sub) shapes.
inCenterOfMassTransform2Is the center of mass transform of shape 2 (excluding scale), this is used to provide a transform to the shape cast result so that local hit result quantities can be transformed into world space.
inSubShapeIDCreator1Class that tracks the current sub shape ID for the casting shape
inSubShapeIDCreator2Class that tracks the current sub shape ID for the shape we're casting against
ioCollectorThe collector that receives the results.

◆ sCastShapeVsShapeWorldSpace()

static void CollisionDispatch::sCastShapeVsShapeWorldSpace ( const ShapeCast inShapeCastWorld,
const ShapeCastSettings inShapeCastSettings,
const Shape inShape,
Vec3Arg  inScale,
const ShapeFilter inShapeFilter,
Mat44Arg  inCenterOfMassTransform2,
const SubShapeIDCreator inSubShapeIDCreator1,
const SubShapeIDCreator inSubShapeIDCreator2,
CastShapeCollector ioCollector 
)
inlinestatic

See: sCastShapeVsShapeLocalSpace. The only difference is that the shape cast (inShapeCastWorld) is provided in world space. Note: A shape cast contains the center of mass start of the shape, if you have the world transform of the shape you probably want to construct it using ShapeCast::sFromWorldTransform.

◆ sCollideShapeVsShape()

static void CollisionDispatch::sCollideShapeVsShape ( const Shape inShape1,
const Shape inShape2,
Vec3Arg  inScale1,
Vec3Arg  inScale2,
Mat44Arg  inCenterOfMassTransform1,
Mat44Arg  inCenterOfMassTransform2,
const SubShapeIDCreator inSubShapeIDCreator1,
const SubShapeIDCreator inSubShapeIDCreator2,
const CollideShapeSettings inCollideShapeSettings,
CollideShapeCollector ioCollector,
const ShapeFilter inShapeFilter = { } 
)
inlinestatic

Collide 2 shapes and pass any collision on to ioCollector

Parameters
inShape1The first shape
inShape2The second shape
inScale1Local space scale of shape 1 (scales relative to its center of mass)
inScale2Local space scale of shape 2 (scales relative to its center of mass)
inCenterOfMassTransform1Transform to transform center of mass of shape 1 into world space
inCenterOfMassTransform2Transform to transform center of mass of shape 2 into world space
inSubShapeIDCreator1Class that tracks the current sub shape ID for shape 1
inSubShapeIDCreator2Class that tracks the current sub shape ID for shape 2
inCollideShapeSettingsOptions for the CollideShape test
ioCollectorThe collector that receives the results.
inShapeFilterallows selectively disabling collisions between pairs of (sub) shapes.

◆ sInit()

void CollisionDispatch::sInit ( )
static

Initialize all collision functions with a function that asserts and returns no collision.

◆ sRegisterCastShape()

static void CollisionDispatch::sRegisterCastShape ( EShapeSubType  inType1,
EShapeSubType  inType2,
CastShape  inFunction 
)
inlinestatic

Register a cast shape function in the collision table.

◆ sRegisterCollideShape()

static void CollisionDispatch::sRegisterCollideShape ( EShapeSubType  inType1,
EShapeSubType  inType2,
CollideShape  inFunction 
)
inlinestatic

Register a collide shape function in the collision table.

◆ sReversedCastShape()

void CollisionDispatch::sReversedCastShape ( const ShapeCast inShapeCast,
const ShapeCastSettings inShapeCastSettings,
const Shape inShape,
Vec3Arg  inScale,
const ShapeFilter inShapeFilter,
Mat44Arg  inCenterOfMassTransform2,
const SubShapeIDCreator inSubShapeIDCreator1,
const SubShapeIDCreator inSubShapeIDCreator2,
CastShapeCollector ioCollector 
)
static

An implementation of CastShape that swaps inShape1 and inShape2 and swaps the result back, can be registered if the collision function only exists the other way around.

◆ sReversedCollideShape()

void CollisionDispatch::sReversedCollideShape ( const Shape inShape1,
const Shape inShape2,
Vec3Arg  inScale1,
Vec3Arg  inScale2,
Mat44Arg  inCenterOfMassTransform1,
Mat44Arg  inCenterOfMassTransform2,
const SubShapeIDCreator inSubShapeIDCreator1,
const SubShapeIDCreator inSubShapeIDCreator2,
const CollideShapeSettings inCollideShapeSettings,
CollideShapeCollector ioCollector,
const ShapeFilter inShapeFilter 
)
static

An implementation of CollideShape that swaps inShape1 and inShape2 and swaps the result back, can be registered if the collision function only exists the other way around.


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