Jolt Physics
A multi core friendly Game Physics Engine
|
Collision tester that tests collision using a sphere cast. More...
#include <VehicleCollisionTester.h>
Public Member Functions | |
JPH_OVERRIDE_NEW_DELETE | VehicleCollisionTesterCastSphere (ObjectLayer inObjectLayer, float inRadius, Vec3Arg inUp=Vec3::sAxisY(), float inMaxSlopeAngle=DegreesToRadians(80.0f)) |
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. 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 BroadPhaseLayerFilter * | GetBroadPhaseLayerFilter () 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 ObjectLayerFilter * | GetObjectLayerFilter () 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 BodyFilter * | GetBodyFilter () 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 |
RefTarget & | operator= (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 |
Additional Inherited Members | |
Static Public Member Functions inherited from RefTarget< VehicleCollisionTester > | |
static int | sInternalGetRefCountOffset () |
INTERNAL HELPER FUNCTION USED BY SERIALIZATION. More... | |
Protected Attributes inherited from VehicleCollisionTester | |
const BroadPhaseLayerFilter * | mBroadPhaseLayerFilter = nullptr |
const ObjectLayerFilter * | mObjectLayerFilter = nullptr |
const BodyFilter * | mBodyFilter = nullptr |
ObjectLayer | mObjectLayer = cObjectLayerInvalid |
Protected Attributes inherited from RefTarget< VehicleCollisionTester > | |
atomic< uint32 > | mRefCount |
Current reference count. 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... | |
Collision tester that tests collision using a sphere cast.
|
inline |
Constructor
inObjectLayer | Object layer to test collision with |
inUp | World space up vector, used to avoid colliding with vertical walls. |
inRadius | Radius of sphere |
inMaxSlopeAngle | Max angle (rad) that is considered for colliding wheels. This is to avoid colliding with vertical walls. |
|
overridevirtual |
Do a collision test with the world
inPhysicsSystem | The physics system that should be tested against |
inVehicleConstraint | The vehicle constraint |
inWheelIndex | Index of the wheel that we're testing collision for |
inOrigin | Origin for the test, corresponds to the world space position for the suspension attachment point |
inDirection | Direction for the test (unit vector, world space) |
inVehicleBodyID | This body should be filtered out during collision detection to avoid self collisions |
outBody | Body that the wheel collided with |
outSubShapeID | Sub shape ID that the wheel collided with |
outContactPosition | Contact point between wheel and floor, in world space |
outContactNormal | Contact normal between wheel and floor, pointing away from the floor |
outSuspensionLength | New length of the suspension [0, inSuspensionMaxLength] |
Implements VehicleCollisionTester.
|
overridevirtual |
Do a cheap contact properties prediction based on the contact properties from the last collision test (provided as input parameters)
inPhysicsSystem | The physics system that should be tested against |
inVehicleConstraint | The vehicle constraint |
inWheelIndex | Index of the wheel that we're testing collision for |
inOrigin | Origin for the test, corresponds to the world space position for the suspension attachment point |
inDirection | Direction for the test (unit vector, world space) |
inVehicleBodyID | The body ID for the vehicle itself |
ioBody | Body that the wheel previously collided with |
ioSubShapeID | Sub shape ID that the wheel collided with during the last check |
ioContactPosition | Contact point between wheel and floor during the last check, in world space |
ioContactNormal | Contact normal between wheel and floor during the last check, pointing away from the floor |
ioSuspensionLength | New length of the suspension [0, inSuspensionMaxLength] |
Implements VehicleCollisionTester.