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

Collision tester that tests collision using a cylinder shape. More...

#include <VehicleCollisionTester.h>

Inheritance diagram for VehicleCollisionTesterCastCylinder:
VehicleCollisionTester RefTarget< VehicleCollisionTester > NonCopyable

Public Member Functions

JPH_OVERRIDE_NEW_DELETE VehicleCollisionTesterCastCylinder (ObjectLayer inObjectLayer, float inConvexRadiusFraction=0.1f)
 
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 override
 
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 override
 
- Public Member Functions inherited from VehicleCollisionTester
JPH_OVERRIDE_NEW_DELETE VehicleCollisionTester ()=default
 Constructors.
 
 VehicleCollisionTester (ObjectLayer inObjectLayer)
 
virtual ~VehicleCollisionTester ()=default
 Virtual destructor.
 
ObjectLayer GetObjectLayer () const
 Object layer to use for collision detection, this is used when the filters are not overridden.
 
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.
 
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.
 
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.
 
const BodyFilterGetBodyFilter () const
 
- Public Member Functions inherited from RefTarget< VehicleCollisionTester >
 RefTarget ()=default
 Constructor.
 
 RefTarget (const RefTarget &)
 
 ~RefTarget ()
 assert no one is referencing us
 
void SetEmbedded () const
 
RefTargetoperator= (const RefTarget &)
 Assignment operator.
 
uint32 GetRefCount () const
 Get current refcount of this object.
 
void AddRef () const
 Add or release a reference to this object.
 
void Release () const
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Additional Inherited Members

- Static Public Member Functions inherited from RefTarget< VehicleCollisionTester >
static int sInternalGetRefCountOffset ()
 INTERNAL HELPER FUNCTION USED BY SERIALIZATION.
 
- Protected Attributes inherited from VehicleCollisionTester
const BroadPhaseLayerFiltermBroadPhaseLayerFilter = nullptr
 
const ObjectLayerFiltermObjectLayerFilter = nullptr
 
const BodyFiltermBodyFilter = nullptr
 
ObjectLayer mObjectLayer = cObjectLayerInvalid
 
- Protected Attributes inherited from RefTarget< VehicleCollisionTester >
atomic< uint32mRefCount
 Current reference count.
 
- 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.
 

Detailed Description

Collision tester that tests collision using a cylinder shape.

Constructor & Destructor Documentation

◆ VehicleCollisionTesterCastCylinder()

JPH_OVERRIDE_NEW_DELETE VehicleCollisionTesterCastCylinder::VehicleCollisionTesterCastCylinder ( ObjectLayer  inObjectLayer,
float  inConvexRadiusFraction = 0.1f 
)
inline

Constructor

Parameters
inObjectLayerObject layer to test collision with
inConvexRadiusFractionFraction of half the wheel width (or wheel radius if it is smaller) that is used as the convex radius

Member Function Documentation

◆ Collide()

bool VehicleCollisionTesterCastCylinder::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
overridevirtual

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

Implements VehicleCollisionTester.

◆ PredictContactProperties()

void VehicleCollisionTesterCastCylinder::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
overridevirtual

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]

Implements VehicleCollisionTester.


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