29#ifndef PX_VEHICLE_DRIVE_H
30#define PX_VEHICLE_DRIVE_H
32#include "vehicle/PxVehicleWheels.h"
33#include "vehicle/PxVehicleComponents.h"
43class PxVehicleDrivableSurfaceToTireFrictionPairs;
150 bool isValid()
const;
156 PxVehicleDriveSimData(
const PxEMPTY) : mEngine(PxEmpty), mGears(PxEmpty), mClutch(PxEmpty), mAutoBox(PxEmpty) {}
157 static void getBinaryMetaData(PxOutputStream& stream);
173 eMAX_NB_ANALOG_INPUTS=16
181 void setToRestState();
189 void setAnalogInput(
const PxU32 type,
const PxReal analogVal);
196 PxReal getAnalogInput(
const PxU32 type)
const;
209 mGearUpPressed = digitalVal;
223 mGearDownPressed = digitalVal;
232 return mGearUpPressed;
241 return mGearDownPressed;
251 mUseAutoGears=useAutoGears;
260 return mUseAutoGears;
269 mUseAutoGears = !mUseAutoGears;
285 mCurrentGear = currentGear;
313 mTargetGear = targetGear;
339 mTargetGear=targetGear;
351 mTargetGear=targetGear;
352 mCurrentGear=targetGear;
362 mEnginespeed = speed;
386 return mGearSwitchTime;
398 return mAutoBoxSwitchTime;
410 PxReal mControlAnalogVals[eMAX_NB_ANALOG_INPUTS];
473 bool isValid()
const;
479 PxU32 getNbAnalogInput()
const {
return eMAX_NB_ANALOG_INPUTS; }
480 PX_FORCE_INLINE void setGearChange(
const PxU32 gearChange) { mTargetGear= gearChange; }
482 PX_FORCE_INLINE void setGearSwitchTime(
const PxReal switchTime) { mGearSwitchTime = switchTime; }
483 PX_FORCE_INLINE void setAutoBoxSwitchTime(
const PxReal autoBoxSwitchTime) { mAutoBoxSwitchTime = autoBoxSwitchTime; }
515 bool isValid()
const;
520 void setToRestState();
525 static PxU32 computeByteSize(
const PxU32 numWheels);
526 static PxU8* patchupPointers(
const PxU32 nbWheels,
PxVehicleDrive* vehDrive, PxU8* ptr);
527 virtual void init(
const PxU32 numWheels);
541 const PxU32 nbDrivenWheels,
const PxU32 nbNonDrivenWheels);
551 virtual bool isKindOf(
const char* name)
const {
return !::strcmp(
"PxVehicleDrive", name) || PxBase::isKindOf(name); }
Output stream class for I/O.
Definition PxIO.h:114
Abstract singleton factory class used for instancing objects in the Physics SDK.
Definition PxPhysics.h:91
PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK.
Definition PxRigidDynamic.h:82
Definition PxVehicleComponents.h:344
Definition PxVehicleComponents.h:661
Data structure with instanced dynamics data for vehicle with engine, clutch, gears,...
Definition PxVehicleDrive.h:168
PX_FORCE_INLINE void setUseAutoGears(const bool useAutoGears)
Set the flag that will be used to select auto-gears If useAutoGears is true the auto-box will be acti...
Definition PxVehicleDrive.h:249
PxReal mGearSwitchTime
Reported time that has passed since gear change started.
Definition PxVehicleDrive.h:458
PX_FORCE_INLINE PxReal getGearSwitchTime() const
Return the time that has passed since the current gear change was initiated.
Definition PxVehicleDrive.h:384
PxReal mAutoBoxSwitchTime
Reported time that has passed since last autobox gearup/geardown decision.
Definition PxVehicleDrive.h:464
bool getGearDown() const
Check if the gear-down button has been pressed.
Definition PxVehicleDrive.h:239
PX_FORCE_INLINE PxU32 getCurrentGear() const
Get the current gear.
Definition PxVehicleDrive.h:295
PxU32 mTargetGear
Target gear (different from current gear if a gear change is underway)
Definition PxVehicleDrive.h:446
void setGearUp(const bool digitalVal)
Inform the vehicle that the gear-up button has been pressed.
Definition PxVehicleDrive.h:207
bool mUseAutoGears
Auto-gear flag used by vehicle simulation. Set true to enable the autobox, false to disable the autob...
Definition PxVehicleDrive.h:416
PX_FORCE_INLINE void setEngineRotationSpeed(const PxF32 speed)
Set the rotation speed of the engine (radians per second)
Definition PxVehicleDrive.h:360
PX_FORCE_INLINE void toggleAutoGears()
Toggle the auto-gears flag If useAutoGears is true the auto-box will be active.
Definition PxVehicleDrive.h:267
bool mGearUpPressed
Gear-up digital control value used by vehicle simulation.
Definition PxVehicleDrive.h:425
PX_FORCE_INLINE void forceGearChange(const PxU32 targetGear)
Force an immediate gear change to a target gear.
Definition PxVehicleDrive.h:349
PX_FORCE_INLINE bool getUseAutoGears() const
Get the flag status that is used to select auto-gears.
Definition PxVehicleDrive.h:258
void setGearDown(const bool digitalVal)
Set that the gear-down button has been pressed.
Definition PxVehicleDrive.h:221
PX_FORCE_INLINE void startGearChange(const PxU32 targetGear)
Start a gear change to a target gear.
Definition PxVehicleDrive.h:337
PX_FORCE_INLINE PxU32 getTargetGear() const
Get the target gear.
Definition PxVehicleDrive.h:323
bool mGearDownPressed
Gear-down digital control value used by vehicle simulation.
Definition PxVehicleDrive.h:434
PX_FORCE_INLINE PxReal getEngineRotationSpeed() const
Return the rotation speed of the engine (radians per second)
Definition PxVehicleDrive.h:370
PX_FORCE_INLINE void setCurrentGear(PxU32 currentGear)
Set the current gear.
Definition PxVehicleDrive.h:283
PX_FORCE_INLINE void setTargetGear(PxU32 targetGear)
Set the target gear.
Definition PxVehicleDrive.h:311
PX_FORCE_INLINE PxReal getAutoBoxSwitchTime() const
Return the time that has passed since the autobox last initiated a gear change.
Definition PxVehicleDrive.h:396
bool getGearUp() const
Check if the gear-up button has been pressed.
Definition PxVehicleDrive.h:230
PxU32 mCurrentGear
Current gear.
Definition PxVehicleDrive.h:440
PxReal mEnginespeed
Rotation speed of engine.
Definition PxVehicleDrive.h:452
Data structure describing non-wheel configuration data of a vehicle that has engine,...
Definition PxVehicleDrive.h:53
PX_FORCE_INLINE const PxVehicleAutoBoxData & getAutoBoxData() const
Return the autobox data.
Definition PxVehicleDrive.h:109
PX_FORCE_INLINE const PxVehicleClutchData & getClutchData() const
Return the clutch data.
Definition PxVehicleDrive.h:95
PX_FORCE_INLINE const PxVehicleGearsData & getGearsData() const
Return the gears data.
Definition PxVehicleDrive.h:81
PX_FORCE_INLINE const PxVehicleEngineData & getEngineData() const
Return the engine data.
Definition PxVehicleDrive.h:67
Data structure with instanced dynamics data and configuration data of a tank.
Definition PxVehicleDriveTank.h:147
A complete vehicle with instance dynamics data and configuration data for wheels and engine,...
Definition PxVehicleDrive.h:493
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxVehicleDrive.h:551
PxVehicleDriveDynData mDriveDynData
Dynamics data of vehicle instance.
Definition PxVehicleDrive.h:508
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition PxVehicleDrive.h:547
Definition PxVehicleComponents.h:86
Definition PxVehicleComponents.h:239
Definition PxVehicleUpdate.cpp:4519
Data structure describing configuration data of a vehicle with up to 20 wheels.
Definition PxVehicleWheels.h:129
Data structure with instanced dynamics data and configuration data of a vehicle with just wheels.
Definition PxVehicleWheels.h:827
#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
PxEMPTY
Definition Px.h:87