Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
VehicleCollisionTester Class Referenceabstract

Class that does collision detection between wheels and ground. More...

#include <VehicleCollisionTester.h>

Inheritance diagram for VehicleCollisionTester:
RefTarget< VehicleCollisionTester > NonCopyable VehicleCollisionTesterCastCylinder VehicleCollisionTesterCastSphere VehicleCollisionTesterRay

Public Member Functions

JPH_OVERRIDE_NEW_DELETE VehicleCollisionTester ()=default
 Constructors. More...
 
 VehicleCollisionTester (ObjectLayer inObjectLayer)
 
virtual ~VehicleCollisionTester ()=default
 Virtual destructor. More...
 
ObjectLayer GetObjectLayer () const
 Object layer to use for collision detection, this is used when the filters are not overridden. More...
 
void SetObjectLayer (ObjectLayer inObjectLayer)
 
void SetBroadPhaseLayerFilter (const BroadPhaseLayerFilter *inFilter)
 Access to the broad phase layer filter, when set this overrides the object layer supplied in the constructor. More...
 
const BroadPhaseLayerFilterGetBroadPhaseLayerFilter () const
 
void SetObjectLayerFilter (const ObjectLayerFilter *inFilter)
 Access to the object layer filter, when set this overrides the object layer supplied in the constructor. More...
 
const ObjectLayerFilterGetObjectLayerFilter () const
 
void SetBodyFilter (const BodyFilter *inFilter)
 Access to the body filter, when set this overrides the default filter that filters out the vehicle body. More...
 
const BodyFilterGetBodyFilter () const
 
virtual bool Collide (PhysicsSystem &inPhysicsSystem, const VehicleConstraint &inVehicleConstraint, uint inWheelIndex, RVec3Arg inOrigin, Vec3Arg inDirection, const BodyID &inVehicleBodyID, Body *&outBody, SubShapeID &outSubShapeID, RVec3 &outContactPosition, Vec3 &outContactNormal, float &outSuspensionLength) const =0
 
virtual void PredictContactProperties (PhysicsSystem &inPhysicsSystem, const VehicleConstraint &inVehicleConstraint, uint inWheelIndex, RVec3Arg inOrigin, Vec3Arg inDirection, const BodyID &inVehicleBodyID, Body *&ioBody, SubShapeID &ioSubShapeID, RVec3 &ioContactPosition, Vec3 &ioContactNormal, float &ioSuspensionLength) const =0
 
- Public Member Functions inherited from RefTarget< VehicleCollisionTester >
 RefTarget ()=default
 Constructor. More...
 
 RefTarget (const RefTarget &)
 
 ~RefTarget ()
 assert no one is referencing us More...
 
void SetEmbedded () const
 
RefTargetoperator= (const RefTarget &)
 Assignment operator. More...
 
uint32 GetRefCount () const
 Get current refcount of this object. More...
 
void AddRef () const
 Add or release a reference to this object. More...
 
void Release () const
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Protected Attributes

const BroadPhaseLayerFiltermBroadPhaseLayerFilter = nullptr
 
const ObjectLayerFiltermObjectLayerFilter = nullptr
 
const BodyFiltermBodyFilter = nullptr
 
ObjectLayer mObjectLayer = cObjectLayerInvalid
 
- Protected Attributes inherited from RefTarget< VehicleCollisionTester >
atomic< uint32mRefCount
 Current reference count. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from RefTarget< VehicleCollisionTester >
static int sInternalGetRefCountOffset ()
 INTERNAL HELPER FUNCTION USED BY SERIALIZATION. More...
 
- Static Protected Attributes inherited from RefTarget< VehicleCollisionTester >
static constexpr uint32 cEmbedded
 A large value that gets added to the refcount to mark the object as embedded. More...
 

Detailed Description

Class that does collision detection between wheels and ground.

Constructor & Destructor Documentation

◆ VehicleCollisionTester() [1/2]

JPH_OVERRIDE_NEW_DELETE VehicleCollisionTester::VehicleCollisionTester ( )
default

Constructors.

◆ VehicleCollisionTester() [2/2]

VehicleCollisionTester::VehicleCollisionTester ( ObjectLayer  inObjectLayer)
inlineexplicit

◆ ~VehicleCollisionTester()

virtual VehicleCollisionTester::~VehicleCollisionTester ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ Collide()

virtual bool VehicleCollisionTester::Collide ( PhysicsSystem inPhysicsSystem,
const VehicleConstraint inVehicleConstraint,
uint  inWheelIndex,
RVec3Arg  inOrigin,
Vec3Arg  inDirection,
const BodyID inVehicleBodyID,
Body *&  outBody,
SubShapeID outSubShapeID,
RVec3 outContactPosition,
Vec3 outContactNormal,
float &  outSuspensionLength 
) const
pure virtual

Do a collision test with the world

Parameters
inPhysicsSystemThe physics system that should be tested against
inVehicleConstraintThe vehicle constraint
inWheelIndexIndex of the wheel that we're testing collision for
inOriginOrigin for the test, corresponds to the world space position for the suspension attachment point
inDirectionDirection for the test (unit vector, world space)
inVehicleBodyIDThis body should be filtered out during collision detection to avoid self collisions
outBodyBody that the wheel collided with
outSubShapeIDSub shape ID that the wheel collided with
outContactPositionContact point between wheel and floor, in world space
outContactNormalContact normal between wheel and floor, pointing away from the floor
outSuspensionLengthNew length of the suspension [0, inSuspensionMaxLength]
Returns
True when collision found, false if not

Implemented in VehicleCollisionTesterRay, VehicleCollisionTesterCastSphere, and VehicleCollisionTesterCastCylinder.

◆ GetBodyFilter()

const BodyFilter * VehicleCollisionTester::GetBodyFilter ( ) const
inline

◆ GetBroadPhaseLayerFilter()

const BroadPhaseLayerFilter * VehicleCollisionTester::GetBroadPhaseLayerFilter ( ) const
inline

◆ GetObjectLayer()

ObjectLayer VehicleCollisionTester::GetObjectLayer ( ) const
inline

Object layer to use for collision detection, this is used when the filters are not overridden.

◆ GetObjectLayerFilter()

const ObjectLayerFilter * VehicleCollisionTester::GetObjectLayerFilter ( ) const
inline

◆ PredictContactProperties()

virtual void VehicleCollisionTester::PredictContactProperties ( PhysicsSystem inPhysicsSystem,
const VehicleConstraint inVehicleConstraint,
uint  inWheelIndex,
RVec3Arg  inOrigin,
Vec3Arg  inDirection,
const BodyID inVehicleBodyID,
Body *&  ioBody,
SubShapeID ioSubShapeID,
RVec3 ioContactPosition,
Vec3 ioContactNormal,
float &  ioSuspensionLength 
) const
pure virtual

Do a cheap contact properties prediction based on the contact properties from the last collision test (provided as input parameters)

Parameters
inPhysicsSystemThe physics system that should be tested against
inVehicleConstraintThe vehicle constraint
inWheelIndexIndex of the wheel that we're testing collision for
inOriginOrigin for the test, corresponds to the world space position for the suspension attachment point
inDirectionDirection for the test (unit vector, world space)
inVehicleBodyIDThe body ID for the vehicle itself
ioBodyBody that the wheel previously collided with
ioSubShapeIDSub shape ID that the wheel collided with during the last check
ioContactPositionContact point between wheel and floor during the last check, in world space
ioContactNormalContact normal between wheel and floor during the last check, pointing away from the floor
ioSuspensionLengthNew length of the suspension [0, inSuspensionMaxLength]

Implemented in VehicleCollisionTesterRay, VehicleCollisionTesterCastSphere, and VehicleCollisionTesterCastCylinder.

◆ SetBodyFilter()

void VehicleCollisionTester::SetBodyFilter ( const BodyFilter inFilter)
inline

Access to the body filter, when set this overrides the default filter that filters out the vehicle body.

◆ SetBroadPhaseLayerFilter()

void VehicleCollisionTester::SetBroadPhaseLayerFilter ( const BroadPhaseLayerFilter inFilter)
inline

Access to the broad phase layer filter, when set this overrides the object layer supplied in the constructor.

◆ SetObjectLayer()

void VehicleCollisionTester::SetObjectLayer ( ObjectLayer  inObjectLayer)
inline

◆ SetObjectLayerFilter()

void VehicleCollisionTester::SetObjectLayerFilter ( const ObjectLayerFilter inFilter)
inline

Access to the object layer filter, when set this overrides the object layer supplied in the constructor.

Member Data Documentation

◆ mBodyFilter

const BodyFilter* VehicleCollisionTester::mBodyFilter = nullptr
protected

◆ mBroadPhaseLayerFilter

const BroadPhaseLayerFilter* VehicleCollisionTester::mBroadPhaseLayerFilter = nullptr
protected

◆ mObjectLayer

ObjectLayer VehicleCollisionTester::mObjectLayer = cObjectLayerInvalid
protected

◆ mObjectLayerFilter

const ObjectLayerFilter* VehicleCollisionTester::mObjectLayerFilter = nullptr
protected

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