31#include "vehicle2/PxVehicleAPI.h"
32#include "../physxintegration/PhysXIntegration.h"
34namespace snippetvehicle2
38using namespace physx::vehicle2;
56 if (!autoboxParams.isValid(gearBoxParams))
58 if (!clutchCommandResponseParams.isValid())
60 if (!engineParams.isValid())
62 if (!gearBoxParams.isValid())
64 if (!multiWheelDifferentialParams.isValid(axleDesc))
66 if (!fourWheelDifferentialParams.isValid(axleDesc))
68 if (!tankDifferentialParams.isValid(axleDesc))
70 if (!clutchParams.isValid())
89 throttleCommandResponseState.setToDefault();
90 autoboxState.setToDefault();
91 clutchCommandResponseState.setToDefault();
92 differentialState.setToDefault();
93 wheelConstraintGroupState.setToDefault();
94 engineState.setToDefault();
95 gearboxState.setToDefault();
96 clutchState.setToDefault();
120 eDIFFTYPE_FOURWHEELDRIVE,
121 eDIFFTYPE_MULTIWHEELDRIVE,
126 Enum differentialType,
bool addPhysXBeginEndComponents=
true);
127 virtual void destroy();
129 virtual void initComponentSequence(
bool addPhysXBeginEndComponents);
145 axleDescription = &mBaseParams.axleDescription;
146 commands = &mCommandState;
147 physxActor = &mPhysXState.physxActor;
148 physxSteerState = &mPhysXState.physxSteerState;
149 physxConstraints = &mPhysXState.physxConstraints;
150 rigidBodyState = &mBaseState.rigidBodyState;
151 wheelRigidBody1dStates.
setData(mBaseState.wheelRigidBody1dStates);
153 transmissionCommands = &mTransmissionCommandState;
154 gearParams = &mEngineDriveParams.gearBoxParams;
155 gearState = &mEngineDriveState.gearboxState;
156 engineParams = &mEngineDriveParams.engineParams;
157 engineState = &mEngineDriveState.engineState;
170 axleDescription = &mBaseParams.axleDescription;
171 rigidBodyState = &mBaseState.rigidBodyState;
172 wheelParams.
setData(mBaseParams.wheelParams);
173 wheelShapeLocalPoses.
setData(mPhysXParams.physxWheelShapeLocalPoses);
174 wheelRigidBody1dStates.
setData(mBaseState.wheelRigidBody1dStates);
175 wheelLocalPoses.
setData(mBaseState.wheelLocalPoses);
176 physxActor = &mPhysXState.physxActor;
178 gearState = &mEngineDriveState.gearboxState;
201 axleDescription = &mBaseParams.axleDescription;
203 steerResponseParams = &mBaseParams.steerResponseParams;
205 gearboxParams = &mEngineDriveParams.gearBoxParams;
206 clutchResponseParams = &mEngineDriveParams.clutchCommandResponseParams;
207 engineParams = &mEngineDriveParams.engineParams;
208 rigidBodyState = &mBaseState.rigidBodyState;
209 engineState = &mEngineDriveState.engineState;
210 autoboxParams = &mEngineDriveParams.autoboxParams;
211 commands = &mCommandState;
212 transmissionCommands = (Enum::eDIFFTYPE_TANKDRIVE == mDifferentialType) ? &mTankDriveTransmissionCommandState : &mTransmissionCommandState;
213 brakeResponseStates.
setData(mBaseState.brakeCommandResponseStates);
214 throttleResponseState = &mEngineDriveState.throttleCommandResponseState;
215 steerResponseStates.
setData(mBaseState.steerCommandResponseStates);
216 gearboxResponseState = &mEngineDriveState.gearboxState;
217 clutchResponseState = &mEngineDriveState.clutchCommandResponseState;
218 autoboxState = &mEngineDriveState.autoboxState;
221 virtual void getDataForFourWheelDriveDifferentialStateComponent(
227 axleDescription = &mBaseParams.axleDescription;
228 differentialParams = &mEngineDriveParams.fourWheelDifferentialParams;
229 wheelRigidbody1dStates.
setData(mBaseState.wheelRigidBody1dStates);
230 differentialState = &mEngineDriveState.differentialState;
231 wheelConstraintGroups = &mEngineDriveState.wheelConstraintGroupState;
234 virtual void getDataForMultiWheelDriveDifferentialStateComponent(
239 axleDescription = &mBaseParams.axleDescription;
240 differentialParams = &mEngineDriveParams.multiWheelDifferentialParams;
241 differentialState = &mEngineDriveState.differentialState;
252 axleDescription = &mBaseParams.axleDescription;
253 tankDriveTransmissionCommands = &mTankDriveTransmissionCommandState;
254 wheelParams.
setData(mBaseParams.wheelParams);
255 differentialParams = &mEngineDriveParams.tankDifferentialParams;
256 differentialState = &mEngineDriveState.differentialState;
257 wheelConstraintGroups = &mEngineDriveState.wheelConstraintGroupState;
260 virtual void getDataForEngineDriveActuationStateComponent(
270 axleDescription = &mBaseParams.axleDescription;
271 gearboxParams = &mEngineDriveParams.gearBoxParams;
272 brakeResponseStates.
setData(mBaseState.brakeCommandResponseStates);
273 throttleResponseState = &mEngineDriveState.throttleCommandResponseState;
274 gearboxState = &mEngineDriveState.gearboxState;
275 differentialState = &mEngineDriveState.differentialState;
276 clutchResponseState = &mEngineDriveState.clutchCommandResponseState;
277 actuationStates.
setData(mBaseState.actuationStates);
298 axleDescription = &mBaseParams.axleDescription;
299 wheelParams.
setData(mBaseParams.wheelParams);
300 engineParams = &mEngineDriveParams.engineParams;
301 clutchParams = &mEngineDriveParams.clutchParams;
302 gearboxParams = &mEngineDriveParams.gearBoxParams;
303 brakeResponseStates.
setData(mBaseState.brakeCommandResponseStates);
304 actuationStates.
setData(mBaseState.actuationStates);
305 tireForces.
setData(mBaseState.tireForces);
306 throttleResponseState = &mEngineDriveState.throttleCommandResponseState;
307 clutchResponseState = &mEngineDriveState.clutchCommandResponseState;
308 differentialState = &mEngineDriveState.differentialState;
309 constraintGroupState = Enum::eDIFFTYPE_TANKDRIVE == mDifferentialType ? &mEngineDriveState.wheelConstraintGroupState : NULL;
310 wheelRigidBody1dStates.
setData(mBaseState.wheelRigidBody1dStates);
311 engineState = &mEngineDriveState.engineState;
312 gearboxState = &mEngineDriveState.gearboxState;
313 clutchState = &mEngineDriveState.clutchState;
331 Enum mDifferentialType;
Material class to represent a set of surface properties.
Definition PxMaterial.h:149
Abstract singleton factory class used for instancing objects in the Physics SDK.
Definition PxPhysics.h:91
Determine the actuation state for each wheel for a vehicle propelled by engine torque.
Definition PxVehicleDrivetrainComponents.h:651
Forward the applicable set of control values for a vehicle driven by an engine to a command response ...
Definition PxVehicleDrivetrainComponents.h:303
Forward integrate the angular speed of each wheel and of the engine, accounting for the state of the ...
Definition PxVehicleDrivetrainComponents.h:707
Compute the per wheel drive torque split of a differential delivering torque to multiple wheels with ...
Definition PxVehicleDrivetrainComponents.h:501
Compute the per wheel drive torque split of a multi-wheel drive differential.
Definition PxVehicleDrivetrainComponents.h:461
Compute the per wheel drive torque split of a tank drive differential.
Definition PxVehicleDrivetrainComponents.h:545
Definition EngineDrivetrain.h:115
virtual void getDataForTankDriveDifferentialStateComponent(const PxVehicleAxleDescription *&axleDescription, const PxVehicleTankDriveTransmissionCommandState *&tankDriveTransmissionCommands, PxVehicleArrayData< const PxVehicleWheelParams > &wheelParams, const PxVehicleTankDriveDifferentialParams *&differentialParams, PxVehicleDifferentialState *&differentialState, PxVehicleWheelConstraintGroupState *&wheelConstraintGroups)
Provide vehicle data items for this component.
Definition EngineDrivetrain.h:244
virtual void getDataForEngineDrivetrainComponent(const PxVehicleAxleDescription *&axleDescription, PxVehicleArrayData< const PxVehicleWheelParams > &wheelParams, const PxVehicleEngineParams *&engineParams, const PxVehicleClutchParams *&clutchParams, const PxVehicleGearboxParams *&gearboxParams, PxVehicleArrayData< const PxReal > &brakeResponseStates, PxVehicleArrayData< const PxVehicleWheelActuationState > &actuationStates, PxVehicleArrayData< const PxVehicleTireForce > &tireForces, const PxVehicleEngineDriveThrottleCommandResponseState *&throttleResponseState, const PxVehicleClutchCommandResponseState *&clutchResponseState, const PxVehicleDifferentialState *&differentialState, const PxVehicleWheelConstraintGroupState *&constraintGroupState, PxVehicleArrayData< PxVehicleWheelRigidBody1dState > &wheelRigidBody1dStates, PxVehicleEngineState *&engineState, PxVehicleGearboxState *&gearboxState, PxVehicleClutchSlipState *&clutchState)
Provide vehicle data items for this component.
Definition EngineDrivetrain.h:280
virtual void getDataForPhysXActorBeginComponent(const PxVehicleAxleDescription *&axleDescription, const PxVehicleCommandState *&commands, const PxVehicleEngineDriveTransmissionCommandState *&transmissionCommands, const PxVehicleGearboxParams *&gearParams, const PxVehicleGearboxState *&gearState, const PxVehicleEngineParams *&engineParams, PxVehiclePhysXActor *&physxActor, PxVehiclePhysXSteerState *&physxSteerState, PxVehiclePhysXConstraints *&physxConstraints, PxVehicleRigidBodyState *&rigidBodyState, PxVehicleArrayData< PxVehicleWheelRigidBody1dState > &wheelRigidBody1dStates, PxVehicleEngineState *&engineState)
Provide vehicle data items for this component.
Definition EngineDrivetrain.h:131
virtual void getDataForEngineDriveCommandResponseComponent(const PxVehicleAxleDescription *&axleDescription, PxVehicleSizedArrayData< const PxVehicleBrakeCommandResponseParams > &brakeResponseParams, const PxVehicleSteerCommandResponseParams *&steerResponseParams, PxVehicleSizedArrayData< const PxVehicleAckermannParams > &ackermannParams, const PxVehicleGearboxParams *&gearboxParams, const PxVehicleClutchCommandResponseParams *&clutchResponseParams, const PxVehicleEngineParams *&engineParams, const PxVehicleRigidBodyState *&rigidBodyState, const PxVehicleEngineState *&engineState, const PxVehicleAutoboxParams *&autoboxParams, const PxVehicleCommandState *&commands, const PxVehicleEngineDriveTransmissionCommandState *&transmissionCommands, PxVehicleArrayData< PxReal > &brakeResponseStates, PxVehicleEngineDriveThrottleCommandResponseState *&throttleResponseState, PxVehicleArrayData< PxReal > &steerResponseStates, PxVehicleGearboxState *&gearboxResponseState, PxVehicleClutchCommandResponseState *&clutchResponseState, PxVehicleAutoboxState *&autoboxState)
Provide vehicle data items for this component.
Definition EngineDrivetrain.h:181
virtual void getDataForPhysXActorEndComponent(const PxVehicleAxleDescription *&axleDescription, const PxVehicleRigidBodyState *&rigidBodyState, PxVehicleArrayData< const PxVehicleWheelParams > &wheelParams, PxVehicleArrayData< const PxTransform > &wheelShapeLocalPoses, PxVehicleArrayData< const PxVehicleWheelRigidBody1dState > &wheelRigidBody1dStates, PxVehicleArrayData< const PxVehicleWheelLocalPose > &wheelLocalPoses, const PxVehicleGearboxState *&gearState, PxVehiclePhysXActor *&physxActor)
Provide vehicle data items for this component.
Definition EngineDrivetrain.h:160
Definition PhysXIntegration.h:116
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Structure describing parameters affecting mesh cooking.
Definition PxCooking.h:185
A description of a single axle that is to be affected by Ackermann steer correction.
Definition PxVehicleSteeringParams.h:86
Helper struct to pass array type data to vehice components and functions.
Definition PxVehicleParams.h:249
PX_FORCE_INLINE void setData(T *data)
Set the data as an array of structs.
Definition PxVehicleParams.h:261
Definition PxVehicleDrivetrainParams.h:404
Definition PxVehicleDrivetrainStates.h:122
Definition PxVehicleParams.h:53
Distribute a brake response to the wheels of a vehicle.
Definition PxVehicleBrakingParams.h:56
Specifies the maximum clutch strength that occurs when the clutch pedal is fully disengaged and the c...
Definition PxVehicleDrivetrainParams.h:84
Definition PxVehicleDrivetrainStates.h:46
The clutch connects two plates together. One plate rotates with the speed of the engine....
Definition PxVehicleDrivetrainParams.h:141
The clutch is modelled as two spinning plates with one connected to the wheels through the gearing an...
Definition PxVehicleDrivetrainStates.h:266
A description of the state of commands that are applied to the vehicle.
Definition PxVehicleCommandStates.h:53
Definition PxVehicleDrivetrainStates.h:143
Definition PxVehicleDrivetrainStates.h:57
A description of the state of transmission-related commands that are applied to a vehicle with engine...
Definition PxVehicleCommandStates.h:92
Definition PxVehicleDrivetrainParams.h:192
Definition PxVehicleDrivetrainStates.h:67
PxVehicleFourWheelDriveDifferentialParams specifies the wheels that are to receive drive torque from ...
Definition PxVehicleDrivetrainParams.h:672
Definition PxVehicleParams.h:174
Definition PxVehicleDrivetrainParams.h:320
Definition PxVehicleDrivetrainStates.h:85
PxVehicleMultiWheelDriveDifferentialParams specifies the wheels that are to receive drive torque from...
Definition PxVehicleDrivetrainParams.h:600
A description of the PhysX actor and shapes that represent the vehicle in an associated PxScene.
Definition PxVehiclePhysXActorStates.h:55
A mapping between constraint state data and the associated PxConstraint instances.
Definition PxVehiclePhysXConstraintStates.h:317
A description of the previous steer command applied to the vehicle.
Definition PxVehiclePhysXActorStates.h:80
Definition PxVehicleRigidBodyStates.h:47
Definition PxVehicleParams.h:224
Definition PxVehicleParams.h:369
PX_FORCE_INLINE void setDataAndCount(T *data, const PxU32 count)
Set the data as an array of structs and set the number of data entries.
Definition PxVehicleParams.h:376
Distribute a steer response to the wheels of a vehicle.
Definition PxVehicleSteeringParams.h:58
A description of a tank differential.
Definition PxVehicleDrivetrainParams.h:853
A description of the state of transmission-related commands that are applied to a vehicle with tank d...
Definition PxVehicleCommandStates.h:120
Specify groups of wheels that are to be constrained to have pre-determined angular velocity relations...
Definition PxVehicleDrivetrainStates.h:179
Definition EngineDrivetrain.h:41
Definition EngineDrivetrain.h:77