Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
CollideShapeVsShapePerLeaf.h File Reference

Go to the source code of this file.

Functions

template<class LeafCollector >
JPH_NAMESPACE_BEGIN void CollideShapeVsShapePerLeaf (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 Documentation

◆ CollideShapeVsShapePerLeaf()

template<class LeafCollector >
JPH_NAMESPACE_BEGIN void CollideShapeVsShapePerLeaf ( 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 = { } )

Collide 2 shapes and returns at most 1 hit per leaf shape pairs that overlapping. This can be used when not all contacts between the shapes are needed. E.g. when testing a compound with 2 MeshShapes A and B against a compound with 2 SphereShapes C and D, then at most you'll get 4 collisions: AC, AD, BC, BD. The default CollisionDispatch::sCollideShapeVsShape function would return all intersecting triangles in A against C, all in B against C etc.

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.
Template Parameters
LeafCollectorThe type of the collector that will be used to collect hits between leaf pairs. Must be either AnyHitCollisionCollector<CollideShapeCollector> to get any hit (cheapest) or ClosestHitCollisionCollector<CollideShapeCollector> to get the deepest hit (more expensive).