RavEngine
Loading...
Searching...
No Matches
physx::PxVehicleWheelsSimData Class Reference

Data structure describing configuration data of a vehicle with up to 20 wheels. More...

#include <PxVehicleWheels.h>

Public Member Functions

void setChassisMass (const PxF32 chassisMass)
 Setup with mass information that can be applied to the default values of the suspensions, wheels, and tires set in their respective constructors.
 
void free ()
 Free a PxVehicleWheelsSimData instance.
 
PxVehicleWheelsSimData & operator= (const PxVehicleWheelsSimData &src)
 Copy wheel simulation data.
 
void copy (const PxVehicleWheelsSimData &src, const PxU32 srcWheel, const PxU32 trgWheel)
 Copy the data of a single wheel unit (wheel, suspension, tire) from srcWheel of src to trgWheel.
 
PxU32 getNbWheels () const
 Return the number of wheels.
 
const PxVehicleSuspensionData & getSuspensionData (const PxU32 id) const
 Return the suspension data of the idth wheel.
 
const PxVehicleWheelData & getWheelData (const PxU32 id) const
 Return the wheel data of the idth wheel.
 
const PxVehicleTireData & getTireData (const PxU32 id) const
 Return the tire data of the idth wheel.
 
const PxVec3 & getSuspTravelDirection (const PxU32 id) const
 Return the direction of travel of the suspension of the idth wheel.
 
const PxVec3 & getSuspForceAppPointOffset (const PxU32 id) const
 Return the application point of the suspension force of the suspension of the idth wheel as an offset from the rigid body center of mass.
 
const PxVec3 & getTireForceAppPointOffset (const PxU32 id) const
 Return the application point of the tire force of the tire of the idth wheel as an offset from the rigid body center of mass.
 
const PxVec3 & getWheelCentreOffset (const PxU32 id) const
 Return the offset from the rigid body centre of mass to the centre of the idth wheel.
 
PxI32 getWheelShapeMapping (const PxU32 wheelId) const
 Return the wheel mapping for the ith wheel.

 
const PxFilterData & getSceneQueryFilterData (const PxU32 suspId) const
 Return the scene query filter data used by the specified suspension line.
 
PxU32 getNbAntiRollBars () const
 Return the number of unique anti-roll bars that have been added with addAntiRollBarData.
 
const PxVehicleAntiRollBarData & getAntiRollBarData (const PxU32 antiRollId) const
 Return a specific anti-roll bar.
 
PX_FORCE_INLINE const PxVehicleTireLoadFilterData & getTireLoadFilterData () const
 Return the data that describes the filtering of the tire load to produce smoother handling at large time-steps.
 
void setSuspensionData (const PxU32 id, const PxVehicleSuspensionData &susp)
 Set the suspension data of the idth wheel.
 
void setWheelData (const PxU32 id, const PxVehicleWheelData &wheel)
 Set the wheel data of the idth wheel.
 
void setTireData (const PxU32 id, const PxVehicleTireData &tire)
 Set the tire data of the idth wheel.
 
void setSuspTravelDirection (const PxU32 id, const PxVec3 &dir)
 Set the direction of travel of the suspension of the idth wheel.
 
void setSuspForceAppPointOffset (const PxU32 id, const PxVec3 &offset)
 Set the application point of the suspension force of the suspension of the idth wheel.
 
void setTireForceAppPointOffset (const PxU32 id, const PxVec3 &offset)
 Set the application point of the tire force of the tire of the idth wheel.
 
void setWheelCentreOffset (const PxU32 id, const PxVec3 &offset)
 Set the offset from the rigid body centre of mass to the centre of the idth wheel.
 
void setWheelShapeMapping (const PxU32 wheelId, const PxI32 shapeId)
 Set mapping between wheel id and position of corresponding wheel shape in the list of actor shapes.
 
void setSceneQueryFilterData (const PxU32 suspId, const PxFilterData &sqFilterData)
 Set the scene query filter data that will be used for raycasts along the travel direction of the specified suspension. The default value is PxFilterData(0,0,0,0)
 
void setTireLoadFilterData (const PxVehicleTireLoadFilterData &tireLoadFilter)
 Set the data that describes the filtering of the tire load to produce smoother handling at large timesteps.
 
PxU32 addAntiRollBarData (const PxVehicleAntiRollBarData &antiRoll)
 Set the anti-roll suspension for a pair of wheels.
 
void disableWheel (const PxU32 wheel)
 Disable a wheel so that zero suspension forces and zero tire forces are applied to the rigid body from this wheel.
 
void enableWheel (const PxU32 wheel)
 Enable a wheel so that suspension forces and tire forces are applied to the rigid body. All wheels are enabled by default and remain enabled until they are disabled.
 
bool getIsWheelDisabled (const PxU32 wheel) const
 Test if a wheel has been disabled.
 
void setSubStepCount (const PxReal thresholdLongitudinalSpeed, const PxU32 lowForwardSpeedSubStepCount, const PxU32 highForwardSpeedSubStepCount)
 Set the number of vehicle sub-steps that will be performed when the vehicle's longitudinal speed is below and above a threshold longitudinal speed.
 
void setMinLongSlipDenominator (const PxReal minLongSlipDenominator)
 Set the minimum denominator used in the longitudinal slip calculation.
 
void setFlags (PxVehicleWheelsSimFlags flags)
 Set the vehicle wheel simulation flags.
 
PxVehicleWheelsSimFlags getFlags () const
 Return the vehicle wheel simulation flags.
 
 PxVehicleWheelsSimData (const PxEMPTY)
 
PxU32 getNbWheels4 () const
 
PxU32 getNbSuspensionData () const
 
PxU32 getNbWheelData () const
 
PxU32 getNbSuspTravelDirection () const
 
PxU32 getNbTireData () const
 
PxU32 getNbSuspForceAppPointOffset () const
 
PxU32 getNbTireForceAppPointOffset () const
 
PxU32 getNbWheelCentreOffset () const
 
PxU32 getNbWheelShapeMapping () const
 
PxU32 getNbSceneQueryFilterData () const
 
PxF32 getMinLongSlipDenominator () const
 
void setThresholdLongSpeed (const PxF32 f)
 
PxF32 getThresholdLongSpeed () const
 
void setLowForwardSpeedSubStepCount (const PxU32 f)
 
PxU32 getLowForwardSpeedSubStepCount () const
 
void setHighForwardSpeedSubStepCount (const PxU32 f)
 
PxU32 getHighForwardSpeedSubStepCount () const
 
void setWheelEnabledState (const PxU32 wheel, const bool state)
 
bool getWheelEnabledState (const PxU32 wheel) const
 
PxU32 getNbWheelEnabledState () const
 
PxU32 getNbAntiRollBars4 () const
 
PxU32 getNbAntiRollBarData () const
 
void setAntiRollBarData (const PxU32 id, const PxVehicleAntiRollBarData &antiRoll)
 

Static Public Member Functions

static PxVehicleWheelsSimData * allocate (const PxU32 nbWheels)
 Allocate a PxVehicleWheelsSimData instance for with nbWheels.
 
static void getBinaryMetaData (PxOutputStream &stream)
 

Friends

class PxVehicleWheels
 
class PxVehicleNoDrive
 
class PxVehicleDrive4W
 
class PxVehicleDriveTank
 
class PxVehicleUpdate
 

Detailed Description

Data structure describing configuration data of a vehicle with up to 20 wheels.

Member Function Documentation

◆ addAntiRollBarData()

PxU32 physx::PxVehicleWheelsSimData::addAntiRollBarData ( const PxVehicleAntiRollBarData &  antiRoll)

Set the anti-roll suspension for a pair of wheels.

Parameters
antiRollis the anti-roll suspension.
Note
If an anti-roll bar has already been set for the same logical wheel pair (independent of wheel index order specified by PxVehicleAntiRollBar.mWheel0 and PxVehicleAntiRollBar.mWheel0) then the existing anti-roll bar is updated with a new stiffness parameter antiRoll.mStiffness.
If the wheel pair specified by antiRoll does not yet have an anti-roll bar then antiRoll is added to a list of anti-roll bars for the vehicle.
Returns
If antiRoll represents a new wheel pair then a unique id is assigned to the anti-roll bar and returned. If antiRoll represents an existing wheel pair then the unique id of the existing anti-roll bar is returned. The return value is always in range (0, getNbAntiRollBars()).
Note
The return value can be used to query the anti-roll bar with getAntiRollBarData(id).
The number of possible anti-roll bars is limited to half the wheel count.
An existing anti-roll bar can be disabled by calling antiRoll.mStiffness to zero.
See also
PxVehicleWheelsSimData::getAntiRollBarData, PxVehicleAntiRollBarData

◆ allocate()

PxVehicleWheelsSimData * physx::PxVehicleWheelsSimData::allocate ( const PxU32  nbWheels)
static

Allocate a PxVehicleWheelsSimData instance for with nbWheels.

See also
free

◆ copy()

void physx::PxVehicleWheelsSimData::copy ( const PxVehicleWheelsSimData &  src,
const PxU32  srcWheel,
const PxU32  trgWheel 
)

Copy the data of a single wheel unit (wheel, suspension, tire) from srcWheel of src to trgWheel.

Parameters
[in]srcis the data to be copied.
[in]srcWheelis the wheel whose data will be copied from src.
[in]trgWheelis the wheel that will be assigned the copied data.

◆ disableWheel()

void physx::PxVehicleWheelsSimData::disableWheel ( const PxU32  wheel)

Disable a wheel so that zero suspension forces and zero tire forces are applied to the rigid body from this wheel.

Note
If the vehicle has a differential (PxVehicleNW/PxVehicle4W) then the differential (PxVehicleDifferentialNWData/PxVehicleDifferential4WData) needs to be configured so that no drive torque is delivered to the disabled wheel.
If the vehicle is of type PxVehicleNoDrive then zero drive torque must be applied to the disabled wheel.
For tanks (PxVehicleDriveTank) any drive torque that could be delivered to the wheel through the tank differential will be re-directed to the remaining enabled wheels.
See also
enableWheel
PxVehicleDifferentialNWData::setDrivenWheel
PxVehicleDifferential4WData::mFrontLeftRightSplit, PxVehicleDifferential4WData::mRearLeftRightSplit, PxVehicleDifferential4WData::mType
PxVehicleNoDrive::setDriveTorque
PxVehicle4WEnable3WTadpoleMode, PxVehicle4WEnable3WDeltaMode
Note
If a PxShape is associated with the disabled wheel then the association must be broken by calling setWheelShapeMapping(wheelId, -1).
See also
setWheelShapeMapping
Note
A wheel that is disabled must also simultaneously be given zero wheel rotation speed.
See also
PxVehicleWheelsDynData::setWheelRotationSpeed
Note
Care must be taken with the sprung mass supported by the remaining enabled wheels. Depending on the desired effect, the mass of the rigid body might need to be distributed among the remaining enabled wheels and suspensions.
Parameters
[in]wheelis the wheel index.

◆ enableWheel()

void physx::PxVehicleWheelsSimData::enableWheel ( const PxU32  wheel)

Enable a wheel so that suspension forces and tire forces are applied to the rigid body. All wheels are enabled by default and remain enabled until they are disabled.

Parameters
[in]wheelis the wheel index.
See also
disableWheel

◆ free()

void physx::PxVehicleWheelsSimData::free ( )

Free a PxVehicleWheelsSimData instance.

See also
allocate

◆ getAntiRollBarData()

const PxVehicleAntiRollBarData & physx::PxVehicleWheelsSimData::getAntiRollBarData ( const PxU32  antiRollId) const

Return a specific anti-roll bar.

Parameters
antiRollIdis the unique id of the anti-roll bar
Note
The return value of addAntiRollBarData is a unique id for that specific anti-roll bar and can be used as input parameter for getAntiRollBarData in order to query the same anti-roll bar.
Alternatively, it is possible to iterate over all anti-roll bars by choosing antiRollId in range (0, getNbAntiRollBars()).

◆ getFlags()

PxVehicleWheelsSimFlags physx::PxVehicleWheelsSimData::getFlags ( ) const

Return the vehicle wheel simulation flags.

Returns
The values of the flags.
See also
PxVehicleWheelsSimFlag

◆ getIsWheelDisabled()

bool physx::PxVehicleWheelsSimData::getIsWheelDisabled ( const PxU32  wheel) const

Test if a wheel has been disabled.

Parameters
[in]wheelis the wheel index.

◆ getNbAntiRollBars()

PxU32 physx::PxVehicleWheelsSimData::getNbAntiRollBars ( ) const
inline

Return the number of unique anti-roll bars that have been added with addAntiRollBarData.

See also
PxVehicleWheelsSimData::addAntiRollBarData

◆ getNbWheels()

PxU32 physx::PxVehicleWheelsSimData::getNbWheels ( ) const
inline

Return the number of wheels.

See also
allocate

◆ getSuspForceAppPointOffset()

const PxVec3 & physx::PxVehicleWheelsSimData::getSuspForceAppPointOffset ( const PxU32  id) const

Return the application point of the suspension force of the suspension of the idth wheel as an offset from the rigid body center of mass.

Note
Specified relative to the center of mass of the rigid body

◆ getTireForceAppPointOffset()

const PxVec3 & physx::PxVehicleWheelsSimData::getTireForceAppPointOffset ( const PxU32  id) const

Return the application point of the tire force of the tire of the idth wheel as an offset from the rigid body center of mass.

Note
Specified relative to the centre of mass of the rigid body

◆ getWheelShapeMapping()

PxI32 physx::PxVehicleWheelsSimData::getWheelShapeMapping ( const PxU32  wheelId) const

Return the wheel mapping for the ith wheel.

Note
The return value is the element in the array of shapes of the vehicle's PxRigidDynamic that corresponds to the ith wheel. A return value of -1 means that the wheel is not mapped to a PxShape.
See also
PxRigidActor.getShapes

◆ operator=()

PxVehicleWheelsSimData & physx::PxVehicleWheelsSimData::operator= ( const PxVehicleWheelsSimData &  src)

Copy wheel simulation data.

Note
The number of wheels on both instances of PxVehicleWheelsSimData must match.

◆ setChassisMass()

void physx::PxVehicleWheelsSimData::setChassisMass ( const PxF32  chassisMass)

Setup with mass information that can be applied to the default values of the suspensions, wheels, and tires set in their respective constructors.

Parameters
chassisMassis the mass of the chassis.
Note
This function assumes that the suspensions equally share the load of the chassis mass. It also assumes that the suspension will have a particular natural frequency and damping ratio that is typical of a standard car. If either of these assumptions is broken then each suspension will need to be individually configured with custom strength, damping rate, and sprung mass.
See also
allocate

◆ setFlags()

void physx::PxVehicleWheelsSimData::setFlags ( PxVehicleWheelsSimFlags  flags)

Set the vehicle wheel simulation flags.

Parameters
[in]flagsThe flags to set (see PxVehicleWheelsSimFlags).

Default: no flag set

See also
PxVehicleWheelsSimFlag

◆ setMinLongSlipDenominator()

void physx::PxVehicleWheelsSimData::setMinLongSlipDenominator ( const PxReal  minLongSlipDenominator)

Set the minimum denominator used in the longitudinal slip calculation.

Note
The longitudinal slip has a theoretical value of (w*r - vz)/|vz|, where w is the angular speed of the wheel; r is the radius of the wheel; and vz is the component of rigid body velocity (computed at the wheel base) that lies along the longitudinal wheel direction. The term |vz| normalizes the slip, while preserving the sign of the longitudinal tire slip. The difficulty here is that when |vz| approaches zero the longitudinal slip approaches infinity. A solution to this problem is to replace the denominator (|vz|) with a value that never falls below a chosen threshold. The longitudinal slip is then calculated with (w*r - vz)/PxMax(|vz|, minLongSlipDenominator).
The default value is the equivalent of 4 metres per second after accounting for the length scale set in PxTolerancesScale.
Adjust this value upwards if a vehicle has difficulty coming to rest.
Decreasing the timestep (or increasing the number of sub-steps at low longitudinal speed with setSubStepCount) should allow stable stable behavior with smaller values of minLongSlipDenominator.

◆ setSceneQueryFilterData()

void physx::PxVehicleWheelsSimData::setSceneQueryFilterData ( const PxU32  suspId,
const PxFilterData &  sqFilterData 
)

Set the scene query filter data that will be used for raycasts along the travel direction of the specified suspension. The default value is PxFilterData(0,0,0,0)

Parameters
suspIdis the wheel index
sqFilterDatais the raycast filter data for the suspension raycast.
See also
setWheelShapeMapping

◆ setSubStepCount()

void physx::PxVehicleWheelsSimData::setSubStepCount ( const PxReal  thresholdLongitudinalSpeed,
const PxU32  lowForwardSpeedSubStepCount,
const PxU32  highForwardSpeedSubStepCount 
)

Set the number of vehicle sub-steps that will be performed when the vehicle's longitudinal speed is below and above a threshold longitudinal speed.

Note
More sub-steps provides better stability but with greater computational cost.
Typically, vehicles require more sub-steps at very low forward speeds.
The threshold longitudinal speed has a default value that is the equivalent of 5 metres per second after accounting for the length scale set in PxTolerancesScale.
The sub-step count below the threshold longitudinal speed has a default of 3.
The sub-step count above the threshold longitudinal speed has a default of 1.
Each sub-step has time advancement equal to the time-step passed to PxVehicleUpdates divided by the number of required sub-steps.
The contact planes of the most recent suspension line raycast are reused across all sub-steps.
Each sub-step computes tire and suspension forces and then advances a velocity, angular velocity and transform.
At the end of all sub-steps the vehicle actor is given the velocity and angular velocity that would move the actor from its start transform prior to the first sub-step to the transform computed at the end of the last substep, assuming it doesn't collide with anything along the way in the next PhysX SDK update.
The global pose of the actor is left unchanged throughout the sub-steps.
Parameters
[in]thresholdLongitudinalSpeedis a threshold speed that is used to categorize vehicle speed as low speed or high speed.
[in]lowForwardSpeedSubStepCountis the number of sub-steps performed in PxVehicleUpates for vehicles that have longitudinal speed lower than thresholdLongitudinalSpeed.
[in]highForwardSpeedSubStepCountis the number of sub-steps performed in PxVehicleUpdates for vehicles that have longitudinal speed graeter than thresholdLongitudinalSpeed.

◆ setSuspensionData()

void physx::PxVehicleWheelsSimData::setSuspensionData ( const PxU32  id,
const PxVehicleSuspensionData &  susp 
)

Set the suspension data of the idth wheel.

Parameters
[in]idis the wheel index.
[in]suspis the suspension data to be applied.

◆ setSuspForceAppPointOffset()

void physx::PxVehicleWheelsSimData::setSuspForceAppPointOffset ( const PxU32  id,
const PxVec3 &  offset 
)

Set the application point of the suspension force of the suspension of the idth wheel.

Parameters
[in]idis the wheel index
[in]offsetis the offset from the rigid body center of mass to the application point of the suspension force.
Note
Specified relative to the centre of mass of the rigid body

◆ setSuspTravelDirection()

void physx::PxVehicleWheelsSimData::setSuspTravelDirection ( const PxU32  id,
const PxVec3 &  dir 
)

Set the direction of travel of the suspension of the idth wheel.

Parameters
[in]idis the wheel index
[in]diris the suspension travel direction to be applied.

◆ setTireData()

void physx::PxVehicleWheelsSimData::setTireData ( const PxU32  id,
const PxVehicleTireData &  tire 
)

Set the tire data of the idth wheel.

Parameters
[in]idis the wheel index.
[in]tireis the tire data to be applied.

◆ setTireForceAppPointOffset()

void physx::PxVehicleWheelsSimData::setTireForceAppPointOffset ( const PxU32  id,
const PxVec3 &  offset 
)

Set the application point of the tire force of the tire of the idth wheel.

Parameters
[in]idis the wheel index
[in]offsetis the offset from the rigid body center of mass to the application point of the tire force.
Note
Specified relative to the centre of mass of the rigid body

◆ setTireLoadFilterData()

void physx::PxVehicleWheelsSimData::setTireLoadFilterData ( const PxVehicleTireLoadFilterData &  tireLoadFilter)

Set the data that describes the filtering of the tire load to produce smoother handling at large timesteps.

Parameters
tireLoadFilteris the smoothing function data.

◆ setWheelCentreOffset()

void physx::PxVehicleWheelsSimData::setWheelCentreOffset ( const PxU32  id,
const PxVec3 &  offset 
)

Set the offset from the rigid body centre of mass to the centre of the idth wheel.

Parameters
[in]idis the wheel index
[in]offsetis the offset from the rigid body center of mass to the center of the wheel at rest.
Note
Specified relative to the centre of mass of the rigid body

◆ setWheelData()

void physx::PxVehicleWheelsSimData::setWheelData ( const PxU32  id,
const PxVehicleWheelData &  wheel 
)

Set the wheel data of the idth wheel.

Parameters
[in]idis the wheel index.
[in]wheelis the wheel data to be applied.

◆ setWheelShapeMapping()

void physx::PxVehicleWheelsSimData::setWheelShapeMapping ( const PxU32  wheelId,
const PxI32  shapeId 
)

Set mapping between wheel id and position of corresponding wheel shape in the list of actor shapes.

Note
This mapping is used to pose the correct wheel shapes with the latest wheel rotation angle, steer angle, and suspension travel while allowing arbitrary ordering of the wheel shapes in the actor's list of shapes.
Use setWheelShapeMapping(i,-1) to register that there is no wheel shape corresponding to the ith wheel
Set setWheelShapeMapping(i,k) to register that the ith wheel corresponds to the kth shape in the actor's list of shapes.
The default values correspond to setWheelShapeMapping(i,i) for all wheels.
Calling this function will also pose the relevant PxShape at the rest position of the wheel.
Parameters
wheelIdis the wheel index
shapeIdis the shape index.
See also
PxVehicleUpdates, PxVehicleDrive4W::setup, PxVehicleDriveTank::setup, PxVehicleNoDrive::setup, setSceneQueryFilterData, PxRigidActor::getShapes

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