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

Filter class. More...

#include <ShapeFilter.h>

Inheritance diagram for ShapeFilter:
NonCopyable ReversedShapeFilter SimShapeFilterWrapper

Public Member Functions

virtual ~ShapeFilter ()=default
 Destructor.
 
virtual bool ShouldCollide (const Shape *inShape2, const SubShapeID &inSubShapeIDOfShape2) const
 
virtual bool ShouldCollide (const Shape *inShape1, const SubShapeID &inSubShapeIDOfShape1, const Shape *inShape2, const SubShapeID &inSubShapeIDOfShape2) const
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Public Attributes

BodyID mBodyID2
 

Detailed Description

Filter class.

Constructor & Destructor Documentation

◆ ~ShapeFilter()

virtual ShapeFilter::~ShapeFilter ( )
virtualdefault

Destructor.

Member Function Documentation

◆ ShouldCollide() [1/2]

virtual bool ShapeFilter::ShouldCollide ( const Shape inShape1,
const SubShapeID inSubShapeIDOfShape1,
const Shape inShape2,
const SubShapeID inSubShapeIDOfShape2 
) const
inlinevirtual

Filter function to determine if two shapes should collide. Returns true if the filter passes. This overload is called when querying a shape vs a shape (e.g. collide object / cast object). It is called at each level of the shape hierarchy, so if you have a compound shape with a box, this function will be called twice. It will not be called on triangles that are part of another shape, i.e a mesh shape will not trigger a callback per triangle. You can filter out individual triangles in the CollisionCollector::AddHit function by their sub shape ID.

Parameters
inShape11st shape that is colliding
inSubShapeIDOfShape1The sub shape ID that will lead from the root shape to inShape1 (i.e. the shape that is used to collide or cast against shape 2)
inShape22nd shape that is colliding
inSubShapeIDOfShape2The sub shape ID that will lead from the root shape to inShape2 (i.e. the shape of mBodyID2)

Reimplemented in ReversedShapeFilter, and SimShapeFilterWrapper.

◆ ShouldCollide() [2/2]

virtual bool ShapeFilter::ShouldCollide ( const Shape inShape2,
const SubShapeID inSubShapeIDOfShape2 
) const
inlinevirtual

Filter function to determine if we should collide with a shape. Returns true if the filter passes. This overload is called when the query doesn't have a source shape (e.g. ray cast / collide point)

Parameters
inShape2Shape we're colliding against
inSubShapeIDOfShape2The sub shape ID that will lead from the root shape to inShape2 (i.e. the shape of mBodyID2)

Reimplemented in ReversedShapeFilter, and SimShapeFilterWrapper.

Member Data Documentation

◆ mBodyID2

BodyID ShapeFilter::mBodyID2
mutable

Used during NarrowPhase queries and TransformedShape queries. Set to the body ID of inShape2 before calling ShouldCollide. Provides context to the filter to indicate which body is colliding.


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