|
| VehicleConstraint (Body &inVehicleBody, const VehicleConstraintSettings &inSettings) |
| Constructor / destructor. More...
|
|
virtual | ~VehicleConstraint () override |
|
virtual EConstraintSubType | GetSubType () const override |
| Get the type of a constraint. More...
|
|
void | SetMaxPitchRollAngle (float inMaxPitchRollAngle) |
| Defines the maximum pitch/roll angle (rad), can be used to avoid the car from getting upside down. The vehicle up direction will stay within a cone centered around the up axis with half top angle mMaxPitchRollAngle, set to pi to turn off. More...
|
|
void | SetVehicleCollisionTester (const VehicleCollisionTester *inTester) |
| Set the interface that tests collision between wheel and ground. More...
|
|
void | SetCombineFriction (const CombineFunction &inCombineFriction) |
|
const CombineFunction & | GetCombineFriction () const |
|
const StepCallback & | GetPreStepCallback () const |
|
void | SetPreStepCallback (const StepCallback &inPreStepCallback) |
|
const StepCallback & | GetPostCollideCallback () const |
|
void | SetPostCollideCallback (const StepCallback &inPostCollideCallback) |
|
const StepCallback & | GetPostStepCallback () const |
|
void | SetPostStepCallback (const StepCallback &inPostStepCallback) |
|
Vec3 | GetLocalForward () const |
| Get the local space forward vector of the vehicle. More...
|
|
Vec3 | GetLocalUp () const |
| Get the local space up vector of the vehicle. More...
|
|
Vec3 | GetWorldUp () const |
| Vector indicating the world space up direction (used to limit vehicle pitch/roll), calculated every frame by inverting gravity. More...
|
|
Body * | GetVehicleBody () const |
| Access to the vehicle body. More...
|
|
const VehicleController * | GetController () const |
| Access to the vehicle controller interface (determines acceleration / deceleration) More...
|
|
VehicleController * | GetController () |
| Access to the vehicle controller interface (determines acceleration / deceleration) More...
|
|
const Wheels & | GetWheels () const |
| Get the state of the wheels. More...
|
|
Wheels & | GetWheels () |
| Get the state of a wheels (writable interface, allows you to make changes to the configuration which will take effect the next time step) More...
|
|
Wheel * | GetWheel (uint inIdx) |
| Get the state of a wheel. More...
|
|
const Wheel * | GetWheel (uint inIdx) const |
|
void | GetWheelLocalBasis (const Wheel *inWheel, Vec3 &outForward, Vec3 &outUp, Vec3 &outRight) const |
|
Mat44 | GetWheelLocalTransform (uint inWheelIndex, Vec3Arg inWheelRight, Vec3Arg inWheelUp) const |
|
RMat44 | GetWheelWorldTransform (uint inWheelIndex, Vec3Arg inWheelRight, Vec3Arg inWheelUp) const |
|
void | SetNumStepsBetweenCollisionTestActive (uint inSteps) |
|
uint | GetNumStepsBetweenCollisionTestActive () const |
|
void | SetNumStepsBetweenCollisionTestInactive (uint inSteps) |
|
uint | GetNumStepsBetweenCollisionTestInactive () const |
|
virtual bool | IsActive () const override |
|
virtual void | NotifyShapeChanged (const BodyID &inBodyID, Vec3Arg inDeltaCOM) override |
|
virtual void | SetupVelocityConstraint (float inDeltaTime) override |
|
virtual void | ResetWarmStart () override |
|
virtual void | WarmStartVelocityConstraint (float inWarmStartImpulseRatio) override |
|
virtual bool | SolveVelocityConstraint (float inDeltaTime) override |
|
virtual bool | SolvePositionConstraint (float inDeltaTime, float inBaumgarte) override |
|
virtual void | BuildIslands (uint32 inConstraintIndex, IslandBuilder &ioBuilder, BodyManager &inBodyManager) override |
| Link bodies that are connected by this constraint in the island builder. More...
|
|
virtual uint | BuildIslandSplits (LargeIslandSplitter &ioSplitter) const override |
| Link bodies that are connected by this constraint in the same split. Returns the split index. More...
|
|
virtual void | DrawConstraint (DebugRenderer *inRenderer) const override |
|
virtual void | DrawConstraintLimits (DebugRenderer *inRenderer) const override |
|
virtual void | SaveState (StateRecorder &inStream) const override |
| Saving state for replay. More...
|
|
virtual void | RestoreState (StateRecorder &inStream) override |
| Restoring state for replay. More...
|
|
virtual Ref< ConstraintSettings > | GetConstraintSettings () const override |
| Debug function to convert a constraint to its settings, note that this will not save to which bodies the constraint is connected to. More...
|
|
JPH_OVERRIDE_NEW_DELETE | Constraint (const ConstraintSettings &inSettings) |
| Constructor. More...
|
|
virtual | ~Constraint ()=default |
| Virtual destructor. More...
|
|
virtual EConstraintType | GetType () const |
| Get the type of a constraint. More...
|
|
virtual EConstraintSubType | GetSubType () const =0 |
| Get the sub type of a constraint. More...
|
|
uint32 | GetConstraintPriority () const |
|
void | SetConstraintPriority (uint32 inPriority) |
|
void | SetNumVelocityStepsOverride (uint inN) |
| Used only when the constraint is active. Override for the number of solver velocity iterations to run, 0 means use the default in PhysicsSettings::mNumVelocitySteps. The number of iterations to use is the max of all contacts and constraints in the island. More...
|
|
uint | GetNumVelocityStepsOverride () const |
|
void | SetNumPositionStepsOverride (uint inN) |
| Used only when the constraint is active. Override for the number of solver position iterations to run, 0 means use the default in PhysicsSettings::mNumPositionSteps. The number of iterations to use is the max of all contacts and constraints in the island. More...
|
|
uint | GetNumPositionStepsOverride () const |
|
void | SetEnabled (bool inEnabled) |
|
bool | GetEnabled () const |
| Test if a constraint is enabled. More...
|
|
uint64 | GetUserData () const |
| Access to the user data, can be used for anything by the application. More...
|
|
void | SetUserData (uint64 inUserData) |
|
virtual void | NotifyShapeChanged (const BodyID &inBodyID, Vec3Arg inDeltaCOM)=0 |
|
virtual void | ResetWarmStart ()=0 |
|
virtual void | BuildIslands (uint32 inConstraintIndex, IslandBuilder &ioBuilder, BodyManager &inBodyManager)=0 |
| Link bodies that are connected by this constraint in the island builder. More...
|
|
virtual uint | BuildIslandSplits (LargeIslandSplitter &ioSplitter) const =0 |
| Link bodies that are connected by this constraint in the same split. Returns the split index. More...
|
|
virtual void | DrawConstraint (DebugRenderer *inRenderer) const =0 |
|
virtual void | DrawConstraintLimits (DebugRenderer *inRenderer) const |
|
virtual void | DrawConstraintReferenceFrame (DebugRenderer *inRenderer) const |
|
float | GetDrawConstraintSize () const |
| Size of constraint when drawing it through the debug renderer. More...
|
|
void | SetDrawConstraintSize (float inSize) |
|
virtual void | SaveState (StateRecorder &inStream) const |
| Saving state for replay. More...
|
|
virtual void | RestoreState (StateRecorder &inStream) |
| Restoring state for replay. More...
|
|
virtual Ref< ConstraintSettings > | GetConstraintSettings () const =0 |
| Debug function to convert a constraint to its settings, note that this will not save to which bodies the constraint is connected to. More...
|
|
| 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 |
|
| NonCopyable ()=default |
|
| NonCopyable (const NonCopyable &)=delete |
|
void | operator= (const NonCopyable &)=delete |
|
virtual | ~PhysicsStepListener ()=default |
| Ensure virtual destructor. More...
|
|
virtual void | OnStep (float inDeltaTime, PhysicsSystem &inPhysicsSystem)=0 |
|
Constraint that simulates a vehicle Note: Don't forget to register the constraint as a StepListener with the PhysicsSystem!
When the vehicle drives over very light objects (rubble) you may see the car body dip down. This is a known issue and is an artifact of the iterative solver that Jolt is using. Basically if a light object is sandwiched between two heavy objects (the static floor and the car body), the light object is not able to transfer enough force from the ground to the car body to keep the car body up. You can see this effect in the HeavyOnLightTest sample, the boxes on the right have a lot of penetration because they're on top of light objects.
There are a couple of ways to improve this:
- You can increase the number of velocity steps (global settings PhysicsSettings::mNumVelocitySteps or if you only want to increase it on the vehicle you can use VehicleConstraintSettings::mNumVelocityStepsOverride). E.g. going from 10 to 30 steps in the HeavyOnLightTest sample makes the penetration a lot less. The number of position steps can also be increased (the first prevents the body from going down, the second corrects it if the problem did occur which inevitably happens due to numerical drift). This solution costs CPU cycles.
- You can reduce the mass difference between the vehicle body and the rubble on the floor (by making the rubble heavier or the car lighter).
- You could filter out collisions between the vehicle collision test and the rubble completely. This would make the wheels ignore the rubble but would cause the vehicle to drive through it as if nothing happened. You could create fake wheels (keyframed bodies) that move along with the vehicle and that only collide with rubble (and not the vehicle or the ground). This would cause the vehicle to push away the rubble without the rubble being able to affect the vehicle (unless it hits the main body of course).
Note that when driving over rubble, you may see the wheel jump up and down quite quickly because one frame a collision is found and the next frame not. To alleviate this, it may be needed to smooth the motion of the visual mesh for the wheel.