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

#include <ObjectLayerPairFilterMask.h>

Inheritance diagram for ObjectLayerPairFilterMask:
ObjectLayerPairFilter NonCopyable

Public Member Functions

virtual bool ShouldCollide (ObjectLayer inObject1, ObjectLayer inObject2) const override
 Returns true if two layers can collide. More...
 
- Public Member Functions inherited from ObjectLayerPairFilter
virtual ~ObjectLayerPairFilter ()=default
 Destructor. More...
 
virtual bool ShouldCollide (ObjectLayer inLayer1, ObjectLayer inLayer2) const
 Returns true if two layers can collide. More...
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Static Public Member Functions

static ObjectLayer sGetObjectLayer (uint32 inGroup, uint32 inMask=cMask)
 Construct an ObjectLayer from a group and mask bits. More...
 
static uint32 sGetGroup (ObjectLayer inObjectLayer)
 Get the group bits from an ObjectLayer. More...
 
static uint32 sGetMask (ObjectLayer inObjectLayer)
 Get the mask bits from an ObjectLayer. More...
 

Static Public Attributes

static JPH_OVERRIDE_NEW_DELETE constexpr uint32 cNumBits = JPH_OBJECT_LAYER_BITS / 2
 Number of bits for the group and mask bits. More...
 
static constexpr uint32 cMask = (1 << cNumBits) - 1
 

Detailed Description

Filter class to test if two objects can collide based on their object layer. Used while finding collision pairs. Uses group bits and mask bits. Two layers can collide if Object1.Group & Object2.Mask is non-zero and Object2.Group & Object1.Mask is non-zero. The behavior is similar to that in e.g. Bullet. This implementation works together with BroadPhaseLayerInterfaceMask and ObjectVsBroadPhaseLayerFilterMask

Member Function Documentation

◆ sGetGroup()

static uint32 ObjectLayerPairFilterMask::sGetGroup ( ObjectLayer  inObjectLayer)
inlinestatic

Get the group bits from an ObjectLayer.

◆ sGetMask()

static uint32 ObjectLayerPairFilterMask::sGetMask ( ObjectLayer  inObjectLayer)
inlinestatic

Get the mask bits from an ObjectLayer.

◆ sGetObjectLayer()

static ObjectLayer ObjectLayerPairFilterMask::sGetObjectLayer ( uint32  inGroup,
uint32  inMask = cMask 
)
inlinestatic

Construct an ObjectLayer from a group and mask bits.

◆ ShouldCollide()

virtual bool ObjectLayerPairFilterMask::ShouldCollide ( ObjectLayer  inObject1,
ObjectLayer  inObject2 
) const
inlineoverridevirtual

Returns true if two layers can collide.

Reimplemented from ObjectLayerPairFilter.

Member Data Documentation

◆ cMask

constexpr uint32 ObjectLayerPairFilterMask::cMask = (1 << cNumBits) - 1
staticconstexpr

◆ cNumBits

JPH_OVERRIDE_NEW_DELETE constexpr uint32 ObjectLayerPairFilterMask::cNumBits = JPH_OBJECT_LAYER_BITS / 2
staticconstexpr

Number of bits for the group and mask bits.


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