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

#include <VehicleConstraint.h>

Inheritance diagram for VehicleConstraintSettings:
ConstraintSettings SerializableObject RefTarget< ConstraintSettings > NonCopyable

Public Member Functions

virtual void SaveBinaryState (StreamOut &inStream) const override
 Saves the contents of the constraint settings in binary form to inStream.
 
- Public Member Functions inherited from SerializableObject
virtual ~SerializableObject ()=default
 Constructor.
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 
- Public Member Functions inherited from RefTarget< ConstraintSettings >
 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 Attributes

Vec3 mUp { 0, 1, 0 }
 Vector indicating the up direction of the vehicle (in local space to the body)
 
Vec3 mForward { 0, 0, 1 }
 Vector indicating forward direction of the vehicle (in local space to the body)
 
float mMaxPitchRollAngle = JPH_PI
 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.
 
Array< Ref< WheelSettings > > mWheels
 List of wheels and their properties.
 
Array< VehicleAntiRollBarmAntiRollBars
 List of anti rollbars and their properties.
 
Ref< VehicleControllerSettingsmController
 Defines how the vehicle can accelerate / decelerate.
 
- Public Attributes inherited from ConstraintSettings
bool mEnabled = true
 If this constraint is enabled initially. Use Constraint::SetEnabled to toggle after creation.
 
uint32 mConstraintPriority = 0
 
uint mNumVelocityStepsOverride = 0
 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.
 
uint mNumPositionStepsOverride = 0
 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.
 
float mDrawConstraintSize = 1.0f
 Size of constraint when drawing it through the debug renderer.
 
uint64 mUserData = 0
 User data value (can be used by application)
 

Protected Member Functions

virtual void RestoreBinaryState (StreamIn &inStream) override
 This function should not be called directly, it is used by sRestoreFromBinaryState.
 

Additional Inherited Members

- Public Types inherited from ConstraintSettings
using ConstraintResult = Result< Ref< ConstraintSettings > >
 
- Static Public Member Functions inherited from ConstraintSettings
static ConstraintResult sRestoreFromBinaryState (StreamIn &inStream)
 Creates a constraint of the correct type and restores its contents from the binary stream inStream.
 
- Static Public Member Functions inherited from RefTarget< ConstraintSettings >
static int sInternalGetRefCountOffset ()
 INTERNAL HELPER FUNCTION USED BY SERIALIZATION.
 
- Protected Attributes inherited from RefTarget< ConstraintSettings >
atomic< uint32mRefCount
 Current reference count.
 
- Static Protected Attributes inherited from RefTarget< ConstraintSettings >
static constexpr uint32 cEmbedded
 A large value that gets added to the refcount to mark the object as embedded.
 

Detailed Description

Configuration for constraint that simulates a wheeled vehicle.

The properties in this constraint are largely based on "Car Physics for Games" by Marco Monster. See: https://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html

Member Function Documentation

◆ RestoreBinaryState()

void VehicleConstraintSettings::RestoreBinaryState ( StreamIn inStream)
overrideprotectedvirtual

This function should not be called directly, it is used by sRestoreFromBinaryState.

Reimplemented from ConstraintSettings.

◆ SaveBinaryState()

void VehicleConstraintSettings::SaveBinaryState ( StreamOut inStream) const
overridevirtual

Saves the contents of the constraint settings in binary form to inStream.

Reimplemented from ConstraintSettings.

Member Data Documentation

◆ mAntiRollBars

Array<VehicleAntiRollBar> VehicleConstraintSettings::mAntiRollBars

List of anti rollbars and their properties.

◆ mController

Ref<VehicleControllerSettings> VehicleConstraintSettings::mController

Defines how the vehicle can accelerate / decelerate.

◆ mForward

Vec3 VehicleConstraintSettings::mForward { 0, 0, 1 }

Vector indicating forward direction of the vehicle (in local space to the body)

◆ mMaxPitchRollAngle

float VehicleConstraintSettings::mMaxPitchRollAngle = JPH_PI

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.

◆ mUp

Vec3 VehicleConstraintSettings::mUp { 0, 1, 0 }

Vector indicating the up direction of the vehicle (in local space to the body)

◆ mWheels

Array<Ref<WheelSettings> > VehicleConstraintSettings::mWheels

List of wheels and their properties.


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