29#ifndef PX_VEHICLE_COMPONENTS_H
30#define PX_VEHICLE_COMPONENTS_H
32#include "foundation/PxMemory.h"
33#include "foundation/PxVec3.h"
34#include "common/PxCoreUtilityTypes.h"
35#include "vehicle/PxVehicleSDK.h"
36#include "common/PxTypeInfo.h"
93 eMAX_NB_ENGINE_TORQUE_CURVE_ENTRIES = 8
100 mDampingRateFullThrottle(0.15f),
101 mDampingRateZeroThrottleClutchEngaged(2.0f),
102 mDampingRateZeroThrottleClutchDisengaged(0.35f)
104 mTorqueCurve.addPair(0.0f, 0.8f);
105 mTorqueCurve.addPair(0.33f, 1.0f);
106 mTorqueCurve.addPair(1.0f, 0.8f);
109 mRecipMaxOmega=1.0f/mMaxOmega;
226 PxReal mRecipMaxOmega;
228 bool isValid()
const;
286 mRatios[PxVehicleGearsData::eREVERSE]=-4.0f;
287 mRatios[PxVehicleGearsData::eNEUTRAL]=0.0f;
288 mRatios[PxVehicleGearsData::eFIRST]=4.0f;
289 mRatios[PxVehicleGearsData::eSECOND]=2.0f;
290 mRatios[PxVehicleGearsData::eTHIRD]=1.5f;
291 mRatios[PxVehicleGearsData::eFOURTH]=1.1f;
292 mRatios[PxVehicleGearsData::eFIFTH]=1.0f;
294 for(PxU32 i = PxVehicleGearsData::eSIXTH; i < PxVehicleGearsData::eGEARSRATIO_COUNT; ++i)
303 PxReal mRatios[PxVehicleGearsData::eGEARSRATIO_COUNT];
332 bool isValid()
const;
337 PxReal getGearRatio(PxVehicleGearsData::Enum a)
const {
return mRatios[a];}
338 void setGearRatio(PxVehicleGearsData::Enum a, PxReal ratio) { mRatios[a] = ratio;}
351 for(PxU32 i=0;i<PxVehicleGearsData::eGEARSRATIO_COUNT;i++)
354 mDownRatios[i]=0.50f;
357 mUpRatios[PxVehicleGearsData::eNEUTRAL]=0.15f;
359 mDownRatios[PxVehicleGearsData::eREVERSE]=2.0f;
370 PxReal mUpRatios[PxVehicleGearsData::eGEARSRATIO_COUNT];
380 PxReal mDownRatios[PxVehicleGearsData::eGEARSRATIO_COUNT];
395 mDownRatios[PxVehicleGearsData::eREVERSE]=latency;
407 return mDownRatios[PxVehicleGearsData::eREVERSE];
411 bool isValid()
const;
417 PxReal getUpRatios(PxVehicleGearsData::Enum a)
const {
return mUpRatios[a];}
418 void setUpRatios(PxVehicleGearsData::Enum a, PxReal ratio) { mUpRatios[a] = ratio;}
420 PxReal getDownRatios(PxVehicleGearsData::Enum a)
const {
return mDownRatios[a];}
421 void setDownRatios(PxVehicleGearsData::Enum a, PxReal ratio) { mDownRatios[a] = ratio;}
435 eDIFF_TYPE_LS_FRONTWD,
436 eDIFF_TYPE_LS_REARWD,
438 eDIFF_TYPE_OPEN_FRONTWD,
439 eDIFF_TYPE_OPEN_REARWD,
444 : mFrontRearSplit(0.45f),
445 mFrontLeftRightSplit(0.5f),
446 mRearLeftRightSplit(0.5f),
450 mType(PxVehicleDifferential4WData::eDIFF_TYPE_LS_4WD)
516 PxVehicleDifferential4WData::Enum
mType;
522 bool isValid()
const;
540 PxMemSet(mBitmapBuffer, 0,
sizeof(PxU32) * (((PX_MAX_NB_WHEELS + 31) & ~31) >> 5));
542 mInvNbDrivenWheels=0.0f;
552 void setDrivenWheel(
const PxU32 wheelId,
const bool drivenState);
557 bool getIsDrivenWheel(
const PxU32 wheelId)
const;
561 PxU32 mBitmapBuffer[((PX_MAX_NB_WHEELS + 31) & ~31) >> 5];
562 PxU32 mNbDrivenWheels;
563 PxReal mInvNbDrivenWheels;
566 bool isValid()
const;
571 PxU32 getDrivenWheelStatus()
const;
572 void setDrivenWheelStatus(PxU32 status);
588 mAxleSeparation(0.0f)
638 bool isValid()
const;
668 mAccuracyMode(PxVehicleClutchAccuracyMode::eBEST_POSSIBLE),
669 mEstimateIterations(5)
726 bool isValid()
const;
765 : mMinNormalisedLoad(0),
766 mMinFilteredNormalisedLoad(0.2308f),
767 mMaxNormalisedLoad(3.0f),
768 mMaxFilteredNormalisedLoad(3.0f)
770 mDenominator=1.0f/(mMaxNormalisedLoad - mMinNormalisedLoad);
805 bool isValid()
const;
826 mMaxBrakeTorque(1500.0f),
827 mMaxHandBrakeTorque(0.0f),
952 bool isValid()
const;
963 : mSpringStrength(0.0f),
964 mSpringDamperRate(0.0f),
965 mMaxCompression(0.3f),
969 mCamberAtMaxCompression(0.0f),
970 mCamberAtMaxDroop(0.0f),
971 mRecipMaxCompression(1.0f),
1105 const PxF32 oldStrength = mSpringStrength;
1106 const PxF32 oldSprungMass = mSprungMass;
1107 const PxF32 newStrength = oldStrength * (newSprungMass / oldSprungMass);
1108 mSpringStrength = newStrength;
1109 mSprungMass = newSprungMass;
1119 PxReal mRecipMaxCompression;
1126 PxReal mRecipMaxDroop;
1131 bool isValid()
const;
1142 : mWheel0(0xffffffff),
1143 mWheel1(0xffffffff),
1171 bool isValid()
const;
1182 mLatStiffY(0.3125f*(180.0f / PxPi)),
1183 mLongitudinalStiffnessPerUnitGravity(1000.0f),
1184 mCamberStiffnessPerUnitGravity(0.1f*(180.0f / PxPi)),
1187 mFrictionVsSlipGraph[0][0]=0.0f;
1188 mFrictionVsSlipGraph[0][1]=1.0f;
1189 mFrictionVsSlipGraph[1][0]=0.1f;
1190 mFrictionVsSlipGraph[1][1]=1.0f;
1191 mFrictionVsSlipGraph[2][0]=1.0f;
1192 mFrictionVsSlipGraph[2][1]=1.0f;
1194 mRecipLongitudinalStiffnessPerUnitGravity=1.0f/mLongitudinalStiffnessPerUnitGravity;
1196 mFrictionVsSlipGraphRecipx1Minusx0=1.0f/(mFrictionVsSlipGraph[1][0]-mFrictionVsSlipGraph[0][0]);
1197 mFrictionVsSlipGraphRecipx2Minusx1=1.0f/(mFrictionVsSlipGraph[2][0]-mFrictionVsSlipGraph[1][0]);
1285 PxReal mFrictionVsSlipGraph[3][2];
1326 PxReal mRecipLongitudinalStiffnessPerUnitGravity;
1335 PxReal mFrictionVsSlipGraphRecipx1Minusx0;
1344 PxReal mFrictionVsSlipGraphRecipx2Minusx1;
1348 bool isValid()
const;
Definition PxCoreUtilityTypes.h:113
3 Element vector class.
Definition PxVec3.h:50
Definition PxVehicleComponents.h:579
PxReal mAccuracy
Accuracy of Ackermann steer calculation.
Definition PxVehicleComponents.h:607
PxReal mRearWidth
Distance between center-point of the two rear wheels.
Definition PxVehicleComponents.h:625
PxReal mAxleSeparation
Distance between center of front axle and center of rear axle.
Definition PxVehicleComponents.h:634
PxReal mFrontWidth
Distance between center-point of the two front wheels.
Definition PxVehicleComponents.h:616
Definition PxVehicleComponents.h:1136
Definition PxVehicleComponents.h:344
PxReal getLatency() const
Get the latency time of the autobox.
Definition PxVehicleComponents.h:405
void setLatency(const PxReal latency)
Set the latency time of the autobox.
Definition PxVehicleComponents.h:393
Definition PxVehicleComponents.h:44
PxVec3 mMOI
Moment of inertia of vehicle rigid body actor.
Definition PxVehicleComponents.h:61
PxVec3 mCMOffset
Center of mass offset of vehicle rigid body actor.
Definition PxVehicleComponents.h:75
PxReal mMass
Mass of vehicle rigid body actor.
Definition PxVehicleComponents.h:68
Definition PxVehicleComponents.h:661
PxVehicleClutchAccuracyMode::Enum mAccuracyMode
The engine and wheel rotation speeds that are coupled through the clutch can be updated by choosing o...
Definition PxVehicleComponents.h:707
PxU32 mEstimateIterations
Tune the mathematical accuracy and computational cost of the computed estimate to the wheel and engin...
Definition PxVehicleComponents.h:720
PxReal mStrength
Strength of clutch.
Definition PxVehicleComponents.h:691
Definition PxVehicleComponents.h:427
PxReal mFrontRearSplit
Ratio of torque split between front and rear (>0.5 means more to front, <0.5 means more to rear).
Definition PxVehicleComponents.h:461
PxReal mRearBias
Maximum allowed ratio of rear-left and rear-right wheel rotation speeds. The differential will divert...
Definition PxVehicleComponents.h:509
PxReal mFrontBias
Maximum allowed ratio of front-left and front-right wheel rotation speeds. The differential will dive...
Definition PxVehicleComponents.h:499
PxReal mFrontLeftRightSplit
Ratio of torque split between front-left and front-right (>0.5 means more to front-left,...
Definition PxVehicleComponents.h:470
PxReal mCentreBias
Maximum allowed ratio of average front wheel rotation speed and rear wheel rotation speeds The differ...
Definition PxVehicleComponents.h:489
PxVehicleDifferential4WData::Enum mType
Type of differential.
Definition PxVehicleComponents.h:516
PxReal mRearLeftRightSplit
Ratio of torque split between rear-left and rear-right (>0.5 means more to rear-left,...
Definition PxVehicleComponents.h:479
Definition PxVehicleComponents.h:532
Data structure describing the drive model components of a vehicle with up to 4 driven wheels and up t...
Definition PxVehicleDrive4W.h:56
Data structure describing configuration data of a vehicle with up to PX_MAX_NB_WHEELS driven equally ...
Definition PxVehicleDriveNW.h:55
Data structure describing non-wheel configuration data of a vehicle that has engine,...
Definition PxVehicleDrive.h:53
Definition PxVehicleComponents.h:86
PxReal mMaxOmega
Maximum rotation speed of the engine.
Definition PxVehicleComponents.h:144
PxReal mPeakTorque
Maximum torque available to apply to the engine when the accelerator pedal is at maximum.
Definition PxVehicleComponents.h:135
PxReal mDampingRateZeroThrottleClutchEngaged
Damping rate of engine when full throttle is applied.
Definition PxVehicleComponents.h:179
PX_FORCE_INLINE PxReal getRecipMOI() const
Return value of mRecipMOI(=1.0f/mMOI) that is automatically set by PxVehicleDriveSimData::setEngineDa...
Definition PxVehicleComponents.h:201
PxReal mDampingRateFullThrottle
Damping rate of engine when full throttle is applied.
Definition PxVehicleComponents.h:161
PxReal mDampingRateZeroThrottleClutchDisengaged
Damping rate of engine when full throttle is applied.
Definition PxVehicleComponents.h:196
PxReal mMOI
Moment of inertia of the engine around the axis of rotation.
Definition PxVehicleComponents.h:124
PxFixedSizeLookupTable< eMAX_NB_ENGINE_TORQUE_CURVE_ENTRIES > mTorqueCurve
Graph of normalized torque (torque/mPeakTorque) against normalized engine speed ( engineRotationSpeed...
Definition PxVehicleComponents.h:117
PX_FORCE_INLINE PxReal getRecipMaxOmega() const
Return value of mRecipMaxOmega( = 1.0f / mMaxOmega ) that is automatically set by PxVehicleDriveSimDa...
Definition PxVehicleComponents.h:206
Definition PxVehicleComponents.h:239
PxReal mSwitchTime
Time it takes to switch gear.
Definition PxVehicleComponents.h:326
PxU32 mNbRatios
Number of gears (including reverse and neutral).
Definition PxVehicleComponents.h:317
PxReal mFinalRatio
Gear ratio applied is mRatios[currentGear]*finalRatio.
Definition PxVehicleComponents.h:310
Definition PxVehicleComponents.h:957
PxReal mCamberAtRest
Camber angle (in radians) of wheel when the suspension is at its rest position.
Definition PxVehicleComponents.h:1054
PxReal mCamberAtMaxCompression
Camber angle (in radians) of wheel when the suspension is at maximum compression.
Definition PxVehicleComponents.h:1066
PxReal mCamberAtMaxDroop
Camber angle (in radians) of wheel when the suspension is at maximum droop.
Definition PxVehicleComponents.h:1078
PX_FORCE_INLINE PxReal getRecipMaxCompression() const
Reciprocal of maximum compression.
Definition PxVehicleComponents.h:1087
PX_FORCE_INLINE PxReal getRecipMaxDroop() const
Reciprocal of maximum droop.
Definition PxVehicleComponents.h:1096
PxReal mMaxDroop
Maximum elongation allowed by suspension spring.
Definition PxVehicleComponents.h:1010
void setMassAndPreserveNaturalFrequency(const PxReal newSprungMass)
Set a new sprung mass for the suspension and modify the spring strength so that the natural frequency...
Definition PxVehicleComponents.h:1103
PxReal mSpringDamperRate
Spring damper rate of suspension unit.
Definition PxVehicleComponents.h:992
PxReal mSpringStrength
Spring strength of suspension unit.
Definition PxVehicleComponents.h:983
PxReal mSprungMass
Mass of vehicle that is supported by suspension spring.
Definition PxVehicleComponents.h:1044
PxReal mMaxCompression
Maximum compression allowed by suspension spring.
Definition PxVehicleComponents.h:1001
Definition PxVehicleComponents.h:1176
PX_FORCE_INLINE PxReal getFrictionVsSlipGraphRecipx2Minusx1() const
Return Cached value of 1.0f/(mFrictionVsSlipGraph[2][0]-mFrictionVsSlipGraph[1][0])
Definition PxVehicleComponents.h:1315
PX_FORCE_INLINE PxReal getRecipLongitudinalStiffnessPerUnitGravity() const
Return Cached value of 1.0/mLongitudinalStiffnessPerUnitGravity.
Definition PxVehicleComponents.h:1301
PxReal mLatStiffX
Tire lateral stiffness is a graph of tire load that has linear behavior near zero load and flattens a...
Definition PxVehicleComponents.h:1207
PxReal mCamberStiffnessPerUnitGravity
tire Tire camber stiffness per unity gravitational acceleration.
Definition PxVehicleComponents.h:1250
PxU32 mType
Tire type denoting slicks, wets, snow, winter, summer, all-terrain, mud etc.
Definition PxVehicleComponents.h:1294
PxReal mLongitudinalStiffnessPerUnitGravity
Tire Longitudinal stiffness per unit gravitational acceleration.
Definition PxVehicleComponents.h:1237
PX_FORCE_INLINE PxReal getFrictionVsSlipGraphRecipx1Minusx0() const
Return Cached value of 1.0f/(mFrictionVsSlipGraph[1][0]-mFrictionVsSlipGraph[0][0])
Definition PxVehicleComponents.h:1308
PxReal mLatStiffY
Tire lateral stiffness is a graph of tire load that has linear behavior near zero load and flattens a...
Definition PxVehicleComponents.h:1224
Tire load variation can be strongly dependent on the time-step so it is a good idea to filter it to g...
Definition PxVehicleComponents.h:759
PxReal mMaxNormalisedLoad
Graph point (mMaxNormalisedLoad,mMaxFilteredNormalisedLoad)
Definition PxVehicleComponents.h:786
PxReal mMinFilteredNormalisedLoad
Graph point (mMinNormalisedLoad,mMinFilteredNormalisedLoad)
Definition PxVehicleComponents.h:781
PxReal mMaxFilteredNormalisedLoad
Graph point (mMaxNormalisedLoad,mMaxFilteredNormalisedLoad)
Definition PxVehicleComponents.h:791
PxReal mMinNormalisedLoad
Graph point (mMinNormalisedLoad,mMinFilteredNormalisedLoad)
Definition PxVehicleComponents.h:776
Definition PxVehicleUpdate.cpp:4519
Definition PxVehicleComponents.h:815
PxReal mMaxSteer
Max steer angle that can be achieved by the wheel.
Definition PxVehicleComponents.h:905
PxReal mMaxHandBrakeTorque
Max handbrake torque that can be applied to wheel.
Definition PxVehicleComponents.h:896
PX_FORCE_INLINE PxReal getRecipMOI() const
Return value equal to 1.0f/mRecipMOI.
Definition PxVehicleComponents.h:928
PxReal mDampingRate
Damping rate applied to wheel.
Definition PxVehicleComponents.h:878
PxReal mMOI
Moment of inertia of unit that includes wheel plus tire about the rolling axis.
Definition PxVehicleComponents.h:869
PxReal mToeAngle
Wheel toe angle. This value is ignored by PxVehicleDriveTank and PxVehicleNoDrive.
Definition PxVehicleComponents.h:914
PxReal mRadius
Radius of unit that includes metal wheel plus rubber tire.
Definition PxVehicleComponents.h:842
PxReal mWidth
Maximum width of unit that includes wheel plus tire.
Definition PxVehicleComponents.h:851
PxReal mMass
Mass of unit that includes wheel plus tire.
Definition PxVehicleComponents.h:860
PxReal mMaxBrakeTorque
Max brake torque that can be applied to wheel.
Definition PxVehicleComponents.h:887
PX_FORCE_INLINE PxReal getRecipRadius() const
Return value equal to 1.0f/mRadius.
Definition PxVehicleComponents.h:921
Definition PxVehicleSuspWheelTire4.h:54
Data structure describing configuration data of a vehicle with up to 20 wheels.
Definition PxVehicleWheels.h:129
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_COMPILE_TIME_ASSERT(exp)
Definition PxPreprocessor.h:428
#define PX_DEPRECATED
Definition PxPreprocessor.h:418
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PX_FORCE_INLINE void * PxMemSet(void *dest, PxI32 c, PxU32 count)
Sets the bytes of the provided buffer to the specified value.
Definition PxMemory.h:67
PxEMPTY
Definition Px.h:87
Choose between a potentially more expensive but more accurate solution to the clutch model or a poten...
Definition PxVehicleComponents.h:652