Classes | |
class | PxVehicleChassisData |
class | PxVehicleEngineData |
class | PxVehicleGearsData |
class | PxVehicleAutoBoxData |
class | PxVehicleDifferential4WData |
class | PxVehicleDifferentialNWData |
class | PxVehicleAckermannGeometryData |
struct | PxVehicleClutchAccuracyMode |
Choose between a potentially more expensive but more accurate solution to the clutch model or a potentially cheaper but less accurate solution. More... | |
class | PxVehicleClutchData |
class | PxVehicleTireLoadFilterData |
Tire load variation can be strongly dependent on the time-step so it is a good idea to filter it to give less jerky handling behavior. More... | |
class | PxVehicleWheelData |
class | PxVehicleSuspensionData |
class | PxVehicleAntiRollBarData |
class | PxVehicleTireData |
class | PxVehicleDriveSimData |
Data structure describing non-wheel configuration data of a vehicle that has engine, gears, clutch, and auto-box. More... | |
class | PxVehicleDriveDynData |
Data structure with instanced dynamics data for vehicle with engine, clutch, gears, autobox. More... | |
class | PxVehicleDrive |
A complete vehicle with instance dynamics data and configuration data for wheels and engine,clutch,gears,autobox. More... | |
class | PxVehicleDriveSimData4W |
Data structure describing the drive model components of a vehicle with up to 4 driven wheels and up to 16 un-driven wheels. The drive model incorporates engine, clutch, gears, autobox, differential, and Ackermann steer correction. More... | |
struct | PxVehicleDrive4WWheelOrder |
The ordering of the driven and steered wheels of a PxVehicleDrive4W. More... | |
struct | PxVehicleDrive4WControl |
The control inputs for a PxVehicleDrive4W. More... | |
class | PxVehicleDrive4W |
Data structure with instanced dynamics data and configuration data of a vehicle with up to 4 driven wheels and up to 16 non-driven wheels. More... | |
class | PxVehicleDriveSimDataNW |
Data structure describing configuration data of a vehicle with up to PX_MAX_NB_WHEELS driven equally through the differential. The vehicle has an engine, clutch, gears, autobox, differential. More... | |
struct | PxVehicleDriveNWControl |
The control inputs for a PxVehicleDriveNW. More... | |
class | PxVehicleDriveNW |
Data structure with instanced dynamics data and configuration data of a vehicle with up to PX_MAX_NB_WHEELS driven wheels. More... | |
struct | PxVehicleDriveTankWheelOrder |
The ordering of the wheels of a PxVehicleDriveTank. More... | |
struct | PxVehicleDriveTankControl |
The control inputs for a PxVehicleDriveTank. More... | |
struct | PxVehicleDriveTankControlModel |
Two driving models are supported. More... | |
class | PxVehicleDriveTank |
Data structure with instanced dynamics data and configuration data of a tank. More... | |
class | PxVehicleNoDrive |
Data structure with instanced dynamics data and configuration data of a vehicle with no drive model. More... | |
struct | PxVehicleTypes |
struct | PxVehicleConcreteType |
An enumeration of concrete vehicle classes inheriting from PxBase. More... | |
struct | PxVehicleUpdateMode |
struct | PxVehicleDrivableSurfaceType |
Driving surface type. Each PxMaterial is associated with a corresponding PxVehicleDrivableSurfaceType. More... | |
class | PxVehicleDrivableSurfaceToTireFrictionPairs |
Friction for each combination of driving surface type and tire type. More... | |
struct | PxWheelQueryResult |
Structure containing data describing the non-persistent state of each suspension/wheel/tire unit. This structure is filled out in PxVehicleUpdates and PxVehicleUpdateSingleVehicleAndStoreTelemetryData. More... | |
struct | PxVehicleWheelQueryResult |
struct | PxVehicleWheelConcurrentUpdateData |
Structure containing data that is computed for a wheel during concurrent calls to PxVehicleUpdates but which cannot be safely concurrently applied. More... | |
struct | PxVehicleConcurrentUpdateData |
Structure containing data that is computed for a vehicle and its wheels during concurrent calls to PxVehicleUpdates but which cannot be safely concurrently applied. More... | |
struct | PxVehicleKeySmoothingData |
Used to produce smooth vehicle driving control values from key inputs. More... | |
struct | PxVehiclePadSmoothingData |
Used to produce smooth analog vehicle control values from analog inputs. More... | |
class | PxVehicleDrive4WRawInputData |
Used to produce smooth vehicle driving control values from analog and digital inputs. More... | |
class | PxVehicleDriveNWRawInputData |
Used to produce smooth vehicle driving control values from analog and digital inputs. More... | |
class | PxVehicleDriveTankRawInputData |
Used to produce smooth analog tank control values from analog and digital inputs. More... | |
class | PxVehicleCopyDynamicsMap |
Used by PxVehicleCopyDynamicsData. More... | |
class | PxVehicleWheelsSimData |
Data structure describing configuration data of a vehicle with up to 20 wheels. More... | |
class | PxVehicleWheelsDynData |
Data structure with instanced dynamics data for wheels. More... | |
class | PxVehicleWheels |
Data structure with instanced dynamics data and configuration data of a vehicle with just wheels. More... | |
Defines | |
#define | PX_MAX_NB_WHEELS (20) |
This number is the maximum number of wheels allowed for a vehicle. | |
#define | PX_DEBUG_VEHICLE_ON (1) |
Compiler setting to enable recording of telemetry data. | |
Typedefs | |
typedef void(* | PxVehicleComputeTireForce )(const void *shaderData, const PxF32 tireFriction, const PxF32 longSlip, const PxF32 latSlip, const PxF32 camber, const PxF32 wheelOmega, const PxF32 wheelRadius, const PxF32 recipWheelRadius, const PxF32 restTireLoad, const PxF32 normalisedTireLoad, const PxF32 tireLoad, const PxF32 gravity, const PxF32 recipGravity, PxF32 &wheelTorque, PxF32 &tireLongForceMag, PxF32 &tireLatForceMag, PxF32 &tireAlignMoment) |
Prototype of shader function that is used to compute wheel torque and tire forces. | |
Functions | |
PX_COMPILE_TIME_ASSERT (0==(sizeof(PxVehicleChassisData)&0x0f)) | |
PX_C_EXPORT bool PX_CALL_CONV | PxInitVehicleSDK (PxPhysics &physics, PxSerializationRegistry *serializationRegistry=NULL) |
Initialize the PhysXVehicle library. | |
PX_C_EXPORT void PX_CALL_CONV | PxCloseVehicleSDK (PxSerializationRegistry *serializationRegistry=NULL) |
Shut down the PhysXVehicle library. | |
void | PxVehicleSetBasisVectors (const PxVec3 &up, const PxVec3 &forward) |
Set the basis vectors of the vehicle simulation. | |
void | PxVehicleSetUpdateMode (PxVehicleUpdateMode::Enum vehicleUpdateMode) |
Set the effect of PxVehicleUpdates to be either to modify each vehicle's rigid body actor. | |
void | PxVehicleSetSweepHitRejectionAngles (const PxF32 pointRejectAngle, const PxF32 normalRejectAngle) |
Set threshold angles that are used to determine if a wheel hit is to be resolved by vehicle suspension or by rigid body collision. | |
void | PxVehicleSetMaxHitActorAcceleration (const PxF32 maxHitActorAcceleration) |
Determine the maximum acceleration experienced by PxRigidDynamic instances that are found to be in contact with a wheel. | |
void | PxVehicleSuspensionRaycasts (PxBatchQuery *batchQuery, const PxU32 nbVehicles, PxVehicleWheels **vehicles, const PxU32 nbSceneQueryResults, PxRaycastQueryResult *sceneQueryResults, const bool *vehiclesToRaycast=NULL) |
Perform raycasts for all suspension lines for all vehicles. | |
void | PxVehicleSuspensionSweeps (PxBatchQuery *batchQuery, const PxU32 nbVehicles, PxVehicleWheels **vehicles, const PxU32 nbSceneQueryResults, PxSweepQueryResult *sceneQueryResults, const PxU16 nbHitsPerQuery, const bool *vehiclesToSweep=NULL, const PxF32 sweepWidthScale=1.0f, const PxF32 sweepRadiusScale=1.0f) |
Perform sweeps for all suspension lines for all vehicles. | |
PxU32 | PxVehicleModifyWheelContacts (const PxVehicleWheels &vehicle, const PxU32 wheelId, const PxF32 wheelTangentVelocityMultiplier, const PxReal maxImpulse, PxContactModifyPair &contactModifyPair) |
A function called from PxContactModifyCallback::onContactModify. The function determines if rigid body contact points recorded for the wheel's PxShape are likely to be duplicated and resolved by the wheel's suspension raycast. Contact points that will be resolved by the suspension are ignored. Contact points that are accepted (rather than ignored) are modified to account for the effect of the suspension geometry and the angular speed of the wheel. | |
void | PxVehicleUpdates (const PxReal timestep, const PxVec3 &gravity, const PxVehicleDrivableSurfaceToTireFrictionPairs &vehicleDrivableSurfaceToTireFrictionPairs, const PxU32 nbVehicles, PxVehicleWheels **vehicles, PxVehicleWheelQueryResult *vehicleWheelQueryResults, PxVehicleConcurrentUpdateData *vehicleConcurrentUpdates=NULL) |
Update an array of vehicles by either applying an acceleration to the rigid body actor associated with each vehicle or by an immediate update of the velocity of the actor. | |
void | PxVehiclePostUpdates (const PxVehicleConcurrentUpdateData *vehicleConcurrentUpdates, const PxU32 nbVehicles, PxVehicleWheels **vehicles) |
Apply actor changes that were computed in concurrent calls to PxVehicleUpdates but which could not be safely applied due to the concurrency. | |
void | PxVehicleShiftOrigin (const PxVec3 &shift, const PxU32 nbVehicles, PxVehicleWheels **vehicles) |
Shift the origin of vehicles by the specified vector. | |
bool | PxVehicleIsInAir (const PxVehicleWheelQueryResult &vehWheelQueryResults) |
Test if all wheels of a vehicle are in the air by querying the wheel query data stored in the last call to PxVehicleUpdates. If all wheels are in the air then true is returned. | |
void | PxVehicleDrive4WSmoothDigitalRawInputsAndSetAnalogInputs (const PxVehicleKeySmoothingData &keySmoothing, const PxFixedSizeLookupTable< 8 > &steerVsForwardSpeedTable, const PxVehicleDrive4WRawInputData &rawInputData, const PxReal timestep, const bool isVehicleInAir, PxVehicleDrive4W &focusVehicle) |
Used to smooth and set analog vehicle control values (accel,brake,handbrake,steer) from digital inputs (keyboard). Also used to set boolean gearup, geardown values. | |
void | PxVehicleDrive4WSmoothAnalogRawInputsAndSetAnalogInputs (const PxVehiclePadSmoothingData &padSmoothing, const PxFixedSizeLookupTable< 8 > &steerVsForwardSpeedTable, const PxVehicleDrive4WRawInputData &rawInputData, const PxReal timestep, const bool isVehicleInAir, PxVehicleDrive4W &focusVehicle) |
Used to smooth and set analog vehicle control values from analog inputs (gamepad). Also used to set boolean gearup, geardown values. | |
void | PxVehicleDriveNWSmoothDigitalRawInputsAndSetAnalogInputs (const PxVehicleKeySmoothingData &keySmoothing, const PxFixedSizeLookupTable< 8 > &steerVsForwardSpeedTable, const PxVehicleDriveNWRawInputData &rawInputData, const PxReal timestep, const bool isVehicleInAir, PxVehicleDriveNW &focusVehicle) |
Used to smooth and set analog vehicle control values (accel,brake,handbrake,steer) from digital inputs (keyboard). Also used to set boolean gearup, geardown values. | |
void | PxVehicleDriveNWSmoothAnalogRawInputsAndSetAnalogInputs (const PxVehiclePadSmoothingData &padSmoothing, const PxFixedSizeLookupTable< 8 > &steerVsForwardSpeedTable, const PxVehicleDriveNWRawInputData &rawInputData, const PxReal timestep, const bool isVehicleInAir, PxVehicleDriveNW &focusVehicle) |
Used to smooth and set analog vehicle control values from analog inputs (gamepad). Also used to set boolean gearup, geardown values. | |
void | PxVehicleDriveTankSmoothDigitalRawInputsAndSetAnalogInputs (const PxVehicleKeySmoothingData &keySmoothing, const PxVehicleDriveTankRawInputData &rawInputData, const PxReal timestep, PxVehicleDriveTank &focusVehicle) |
Used to smooth and set analog tank control values from digital inputs (keyboard). Also used to set boolean gearup, geardown values. | |
void | PxVehicleDriveTankSmoothAnalogRawInputsAndSetAnalogInputs (const PxVehiclePadSmoothingData &padSmoothing, const PxVehicleDriveTankRawInputData &rawInputData, const PxReal timestep, PxVehicleDriveTank &focusVehicle) |
Used to smooth and set analog tank control values from analog inputs (gamepad). Also used to set boolean gearup, geardown values. | |
void | PxVehicle4WEnable3WTadpoleMode (PxVehicleWheelsSimData &wheelsSimData, PxVehicleWheelsDynData &wheelsDynData, PxVehicleDriveSimData4W &driveSimData) |
Reconfigure a PxVehicle4W instance as a three-wheeled car with tadpole config (2 front wheels, 1 rear wheel). | |
void | PxVehicle4WEnable3WDeltaMode (PxVehicleWheelsSimData &wheelsSimData, PxVehicleWheelsDynData &wheelsDynData, PxVehicleDriveSimData4W &driveSimData) |
Reconfigure a PxVehicle4W instance as a three-wheeled car with delta config (1 front wheel, 2 rear wheels). | |
void | PxVehicleComputeSprungMasses (const PxU32 nbSprungMasses, const PxVec3 *sprungMassCoordinates, const PxVec3 ¢reOfMass, const PxReal totalMass, const PxU32 gravityDirection, PxReal *sprungMasses) |
Compute the sprung masses of the suspension springs given (i) the number of sprung masses, (ii) coordinates of the sprung masses, (iii) the center of mass offset of the rigid body, (iv) the total mass of the rigid body, and (v) the direction of gravity (0 for x-axis, 1 for y-axis, 2 for z-axis). | |
void | PxVehicleUpdateCMassLocalPose (const PxTransform &oldCMassLocalPose, const PxTransform &newCMassLocalPose, const PxU32 gravityDirection, PxVehicleWheels *vehicle) |
Reconfigure the vehicle to reflect a new center of mass local pose that has been applied to the actor. The function requires (i) the center of mass local pose that was last used to configure the vehicle and the vehicle's actor, (ii) the new center of mass local pose that has been applied to the vehicle's actor and will now be applied to the vehicle, and (iii) the direction of gravity (0 for x-axis, 1 for y-axis, 2 for z-axis). | |
void | PxVehicleCopyDynamicsData (const PxVehicleCopyDynamicsMap &wheelMap, const PxVehicleWheels &src, PxVehicleWheels *trg) |
Copy dynamics data from src to trg, including wheel rotation speed, wheel rotation angle, engine rotation speed etc. |
#define PX_DEBUG_VEHICLE_ON (1) |
Compiler setting to enable recording of telemetry data.
#define PX_MAX_NB_WHEELS (20) |
This number is the maximum number of wheels allowed for a vehicle.
Referenced by PxVehicleCopyDynamicsMap::PxVehicleCopyDynamicsMap(), and PxVehicleDifferentialNWData::PxVehicleDifferentialNWData().
typedef void(* PxVehicleComputeTireForce)(const void *shaderData, const PxF32 tireFriction, const PxF32 longSlip, const PxF32 latSlip, const PxF32 camber, const PxF32 wheelOmega, const PxF32 wheelRadius, const PxF32 recipWheelRadius, const PxF32 restTireLoad, const PxF32 normalisedTireLoad, const PxF32 tireLoad, const PxF32 gravity, const PxF32 recipGravity, PxF32 &wheelTorque, PxF32 &tireLongForceMag, PxF32 &tireLatForceMag, PxF32 &tireAlignMoment) |
Prototype of shader function that is used to compute wheel torque and tire forces.
[in] | shaderData | is the shader data for the tire being processed. The shader data describes the tire data in the format required by the tire model that is implemented by the shader function. |
[in] | tireFriction | is the value of friction for the contact between the tire and the ground. |
[in] | longSlip | is the value of longitudinal slip experienced by the tire. |
[in] | latSlip | is the value of lateral slip experienced by the tire. |
[in] | camber | is the camber angle of the tire in radians. |
[in] | wheelOmega | is the rotational speed of the wheel. |
[in] | wheelRadius | is the distance from the tire surface to the center of the wheel. |
[in] | recipWheelRadius | is the reciprocal of wheelRadius. |
[in] | restTireLoad | is the load force experienced by the tire when the vehicle is at rest. |
[in] | normalisedTireLoad | is a pre-computed value equal to the load force on the tire divided by restTireLoad. |
[in] | tireLoad | is the load force currently experienced by the tire (= restTireLoad*normalisedTireLoad) |
[in] | gravity | is the magnitude of gravitational acceleration. |
[in] | recipGravity | is the reciprocal of the magnitude of gravitational acceleration. |
[out] | wheelTorque | is the torque that is to be applied to the wheel around the wheel's axle. |
[out] | tireLongForceMag | is the magnitude of the longitudinal tire force to be applied to the vehicle's rigid body. |
[out] | tireLatForceMag | is the magnitude of the lateral tire force to be applied to the vehicle's rigid body. |
[out] | tireAlignMoment | is the aligning moment of the tire that is to be applied to the vehicle's rigid body (not currently used). |
PX_COMPILE_TIME_ASSERT | ( | 0 | = =(sizeof(PxVehicleChassisData)&0x0f) |
) |
PX_C_EXPORT void PX_CALL_CONV PxCloseVehicleSDK | ( | PxSerializationRegistry * | serializationRegistry = NULL |
) |
Shut down the PhysXVehicle library.
Call this function as part of the physx shutdown process.
serializationRegistry | PxSerializationRegistry instance, if non-NULL must be the same as passed into PxInitVehicleSDK. |
If the PxSerializationRegistry instance is specified this function must additionally be called prior to shutdown of PhysXExtensions.
PX_C_EXPORT bool PX_CALL_CONV PxInitVehicleSDK | ( | PxPhysics & | physics, | |
PxSerializationRegistry * | serializationRegistry = NULL | |||
) |
Initialize the PhysXVehicle library.
Call this before using any of the vehicle functions.
physics | The PxPhysics instance. | |
serializationRegistry | PxSerializationRegistry instance, if NULL vehicle serialization is not supported. |
If a PxSerializationRegistry instance is specified then PhysXVehicle is also dependent on PhysXExtensions.
void PxVehicle4WEnable3WDeltaMode | ( | PxVehicleWheelsSimData & | wheelsSimData, | |
PxVehicleWheelsDynData & | wheelsDynData, | |||
PxVehicleDriveSimData4W & | driveSimData | |||
) |
Reconfigure a PxVehicle4W instance as a three-wheeled car with delta config (1 front wheel, 2 rear wheels).
[in,out] | wheelsSimData | is the data describing the wheels/suspensions/tires of the vehicle. |
[in,out] | wheelsDynData | is the data describing the dynamic state of the wheels of the vehicle. |
[in,out] | driveSimData | is the data describing the drive model of the vehicle. |
void PxVehicle4WEnable3WTadpoleMode | ( | PxVehicleWheelsSimData & | wheelsSimData, | |
PxVehicleWheelsDynData & | wheelsDynData, | |||
PxVehicleDriveSimData4W & | driveSimData | |||
) |
Reconfigure a PxVehicle4W instance as a three-wheeled car with tadpole config (2 front wheels, 1 rear wheel).
[in,out] | wheelsSimData | is the data describing the wheels/suspensions/tires of the vehicle. |
[in,out] | wheelsDynData | is the data describing the dynamic state of the wheels of the vehicle. |
[in,out] | driveSimData | is the data describing the drive model of the vehicle. |
void PxVehicleComputeSprungMasses | ( | const PxU32 | nbSprungMasses, | |
const PxVec3 * | sprungMassCoordinates, | |||
const PxVec3 & | centreOfMass, | |||
const PxReal | totalMass, | |||
const PxU32 | gravityDirection, | |||
PxReal * | sprungMasses | |||
) |
Compute the sprung masses of the suspension springs given (i) the number of sprung masses, (ii) coordinates of the sprung masses, (iii) the center of mass offset of the rigid body, (iv) the total mass of the rigid body, and (v) the direction of gravity (0 for x-axis, 1 for y-axis, 2 for z-axis).
[in] | nbSprungMasses | is the number of sprung masses of the vehicle. This value corresponds to the number of wheels on the vehicle. |
[in] | sprungMassCoordinates | are the coordinates of the sprung masses relative to the actor. The array sprungMassCoordinates must be of length nbSprungMasses or greater. |
[in] | centreOfMass | is the coordinate of the center of mass of the rigid body relative to the actor. This value corresponds to the value set by PxRigidBody::setCMassLocalPose. |
[in] | totalMass | is the total mass of all the sprung masses. This value corresponds to the value set by PxRigidBody::setMass. |
[in] | gravityDirection | is an integer describing the direction of gravitational acceleration. A value of 0 corresponds to (-1,0,0), a value of 1 corresponds to (0,-1,0) and a value of 2 corresponds to (0,0,-1). |
[out] | sprungMasses | are the masses to set in the associated suspension data with PxVehicleSuspensionData::mSprungMass. The sprungMasses array must be of length nbSprungMasses or greater. Each element in the sprungMasses array corresponds to the suspension located at the same array element in sprungMassCoordinates. The center of mass of the masses in sprungMasses with the coordinates in sprungMassCoordinates satisfy the specified centerOfMass. |
void PxVehicleCopyDynamicsData | ( | const PxVehicleCopyDynamicsMap & | wheelMap, | |
const PxVehicleWheels & | src, | |||
PxVehicleWheels * | trg | |||
) |
Copy dynamics data from src to trg, including wheel rotation speed, wheel rotation angle, engine rotation speed etc.
[in] | wheelMap | - describes the mapping between the wheels in src and the wheels in trg. |
[in] | src | - according to the wheel mapping stored in wheelMap, the dynamics data in src wheels are copied to the corresponding wheels in trg. |
[out] | trg | - according to wheel mapping stored in wheelMap, the wheels in trg are given the dynamics data of the corresponding wheels in src. |
In the event that src has fewer wheels than trg, wheelMap must specify a unique mapping between each src wheel to a trg wheel.
In the event that src has more wheels than trg, wheelMap must specify a unique mapping to each trg wheel from a src wheel.
In the event that src has fewer wheels than trg, the trg wheels that are not mapped to a src wheel are given the average wheel rotation speed of all enabled src wheels.
src and trg must be the same vehicle type.
void PxVehicleDrive4WSmoothAnalogRawInputsAndSetAnalogInputs | ( | const PxVehiclePadSmoothingData & | padSmoothing, | |
const PxFixedSizeLookupTable< 8 > & | steerVsForwardSpeedTable, | |||
const PxVehicleDrive4WRawInputData & | rawInputData, | |||
const PxReal | timestep, | |||
const bool | isVehicleInAir, | |||
PxVehicleDrive4W & | focusVehicle | |||
) |
Used to smooth and set analog vehicle control values from analog inputs (gamepad). Also used to set boolean gearup, geardown values.
[in] | padSmoothing | describes how quickly the control values applied to the vehicle blend from the current vehicle values towards the raw analog values from the gamepad. |
[in] | steerVsForwardSpeedTable | is a table of maximum allowed steer versus forward vehicle speed. |
[in] | rawInputData | is the state of all gamepad analog inputs that will be used control the vehicle. |
[in] | timestep | is the time that has passed since the last call to PxVehicleDrive4WSmoothDigitalRawInputsAndSetAnalogInputs |
[in] | isVehicleInAir | describes if the vehicle is in the air or on the ground and is used to decide whether or not to apply steerVsForwardSpeedTable. |
[in] | focusVehicle | is the vehicle that will be given analog control values arising from the gamepad inputs. |
void PxVehicleDrive4WSmoothDigitalRawInputsAndSetAnalogInputs | ( | const PxVehicleKeySmoothingData & | keySmoothing, | |
const PxFixedSizeLookupTable< 8 > & | steerVsForwardSpeedTable, | |||
const PxVehicleDrive4WRawInputData & | rawInputData, | |||
const PxReal | timestep, | |||
const bool | isVehicleInAir, | |||
PxVehicleDrive4W & | focusVehicle | |||
) |
Used to smooth and set analog vehicle control values (accel,brake,handbrake,steer) from digital inputs (keyboard). Also used to set boolean gearup, geardown values.
[in] | keySmoothing | describes the rise and fall rates of the corresponding analog values when keys are pressed on and off. |
[in] | steerVsForwardSpeedTable | is a table of maximum allowed steer versus forward vehicle speed. |
[in] | rawInputData | is the state of all digital inputs that control the vehicle. |
[in] | timestep | is the time that has passed since the last call to PxVehicleDrive4WSmoothDigitalRawInputsAndSetAnalogInputs |
[in] | isVehicleInAir | describes if the vehicle is in the air or on the ground and is used to decide whether or not to apply steerVsForwardSpeedTable. |
[in] | focusVehicle | is the vehicle that will be given analog and gearup/geardown control values arising from the digital inputs. |
void PxVehicleDriveNWSmoothAnalogRawInputsAndSetAnalogInputs | ( | const PxVehiclePadSmoothingData & | padSmoothing, | |
const PxFixedSizeLookupTable< 8 > & | steerVsForwardSpeedTable, | |||
const PxVehicleDriveNWRawInputData & | rawInputData, | |||
const PxReal | timestep, | |||
const bool | isVehicleInAir, | |||
PxVehicleDriveNW & | focusVehicle | |||
) |
Used to smooth and set analog vehicle control values from analog inputs (gamepad). Also used to set boolean gearup, geardown values.
[in] | padSmoothing | describes how quickly the control values applied to the vehicle blend from the current vehicle values towards the raw analog values from the gamepad. |
[in] | steerVsForwardSpeedTable | is a table of maximum allowed steer versus forward vehicle speed. |
[in] | rawInputData | is the state of all gamepad analog inputs that will be used control the vehicle. |
[in] | timestep | is the time that has passed since the last call to PxVehicleDrive4WSmoothDigitalRawInputsAndSetAnalogInputs |
[in] | isVehicleInAir | describes if the vehicle is in the air or on the ground and is used to decide whether or not to apply steerVsForwardSpeedTable. |
[in] | focusVehicle | is the vehicle that will be given analog control values arising from the gamepad inputs. |
void PxVehicleDriveNWSmoothDigitalRawInputsAndSetAnalogInputs | ( | const PxVehicleKeySmoothingData & | keySmoothing, | |
const PxFixedSizeLookupTable< 8 > & | steerVsForwardSpeedTable, | |||
const PxVehicleDriveNWRawInputData & | rawInputData, | |||
const PxReal | timestep, | |||
const bool | isVehicleInAir, | |||
PxVehicleDriveNW & | focusVehicle | |||
) |
Used to smooth and set analog vehicle control values (accel,brake,handbrake,steer) from digital inputs (keyboard). Also used to set boolean gearup, geardown values.
[in] | keySmoothing | describes the rise and fall rates of the corresponding analog values when keys are pressed on and off. |
[in] | steerVsForwardSpeedTable | is a table of maximum allowed steer versus forward vehicle speed. |
[in] | rawInputData | is the state of all digital inputs that control the vehicle. |
[in] | timestep | is the time that has passed since the last call to PxVehicleDrive4WSmoothDigitalRawInputsAndSetAnalogInputs |
[in] | isVehicleInAir | describes if the vehicle is in the air or on the ground and is used to decide whether or not to apply steerVsForwardSpeedTable. |
[in] | focusVehicle | is the vehicle that will be given analog and gearup/geardown control values arising from the digital inputs. |
void PxVehicleDriveTankSmoothAnalogRawInputsAndSetAnalogInputs | ( | const PxVehiclePadSmoothingData & | padSmoothing, | |
const PxVehicleDriveTankRawInputData & | rawInputData, | |||
const PxReal | timestep, | |||
PxVehicleDriveTank & | focusVehicle | |||
) |
Used to smooth and set analog tank control values from analog inputs (gamepad). Also used to set boolean gearup, geardown values.
[in] | padSmoothing | describes how quickly the control values applied to the vehicle blend from the current vehicle values towards the raw analog values from the gamepad. |
[in] | rawInputData | is the state of all gamepad analog inputs that will be used control the vehicle. |
[in] | timestep | is the time that has passed since the last call to PxVehicleDrive4WSmoothDigitalRawInputsAndSetAnalogInputs |
[in] | focusVehicle | is the vehicle that will be given analog control values arising from the gamepad inputs. |
void PxVehicleDriveTankSmoothDigitalRawInputsAndSetAnalogInputs | ( | const PxVehicleKeySmoothingData & | keySmoothing, | |
const PxVehicleDriveTankRawInputData & | rawInputData, | |||
const PxReal | timestep, | |||
PxVehicleDriveTank & | focusVehicle | |||
) |
Used to smooth and set analog tank control values from digital inputs (keyboard). Also used to set boolean gearup, geardown values.
[in] | keySmoothing | describes the rise and fall rates of the corresponding analog values when keys are pressed on and off. |
[in] | rawInputData | is the state of all digital inputs that control the vehicle. |
[in] | timestep | is the time that has passed since the last call to PxVehicleDrive4WSmoothDigitalRawInputsAndSetAnalogInputs |
[in] | focusVehicle | is the vehicle that will be given analog and gearup/geardown control values arising from the digital inputs. |
bool PxVehicleIsInAir | ( | const PxVehicleWheelQueryResult & | vehWheelQueryResults | ) |
Test if all wheels of a vehicle are in the air by querying the wheel query data stored in the last call to PxVehicleUpdates. If all wheels are in the air then true is returned.
If vehWheelQueryResults.wheelQueryResults is NULL or vehWheelQueryResults.nbWheelQueryResults is 0 then true is returned. This function does not account for wheels that have been disabled since the last execution of PxVehicleUpdates so it is possible that wheels disabled more recently than the last call to PxVehicleUpdates report are treated as touching the ground.
PxU32 PxVehicleModifyWheelContacts | ( | const PxVehicleWheels & | vehicle, | |
const PxU32 | wheelId, | |||
const PxF32 | wheelTangentVelocityMultiplier, | |||
const PxReal | maxImpulse, | |||
PxContactModifyPair & | contactModifyPair | |||
) |
A function called from PxContactModifyCallback::onContactModify. The function determines if rigid body contact points recorded for the wheel's PxShape are likely to be duplicated and resolved by the wheel's suspension raycast. Contact points that will be resolved by the suspension are ignored. Contact points that are accepted (rather than ignored) are modified to account for the effect of the suspension geometry and the angular speed of the wheel.
[in] | vehicle | is a reference to the PxVehicleWheels instance that owns the wheel |
[in] | wheelId | is the id of the wheel |
[in] | wheelTangentVelocityMultiplier | determines the amount of wheel angular velocity that is used to modify the target relative velocity of the contact. The target relative velocity is modified by adding a vector equal to the tangent velocity of the rotating wheel at the contact point and scaled by wheelTangentVelocityMultiplier. The value of wheelTangentVelocityMultiplier is limited to the range (0,1). Higher values mimic higher values of friction and tire load, while lower values mimic lower values of friction and tire load. |
[in] | maxImpulse | determines the maximum impulse strength that the contacts can apply when a wheel is in contact with a PxRigidDynamic. This value is ignored for contacts with PxRigidStatic instances. |
[in,out] | contactModifyPair | describes the set of contacts involving the PxShape of the specified wheel and one other shape. The contacts in the contact set are ignored or modified as required. |
If a contact point is not rejected it is modified to account for the wheel rotation speed.
Set maxImpulse to PX_MAX_F32 to allow any impulse value to be applied.
Reduce maxImpulse if the wheels are frequently colliding with light objects with mass much less than the vehicle's mass. Reducing this value encourages numerical stability.
void PxVehiclePostUpdates | ( | const PxVehicleConcurrentUpdateData * | vehicleConcurrentUpdates, | |
const PxU32 | nbVehicles, | |||
PxVehicleWheels ** | vehicles | |||
) |
Apply actor changes that were computed in concurrent calls to PxVehicleUpdates but which could not be safely applied due to the concurrency.
[in] | vehicleConcurrentUpdates | is an array of length nbVehicles where vehicleConcurrentUpdates[i] contains data describing actor changes that were computed for vehicles[i] during concurrent calls to PxVehicleUpdates. |
[in] | nbVehicles | is the number of vehicles pointers in the vehicles array |
[in,out] | vehicles | is an array of length nbVehicles containing all vehicles that were partially updated in concurrent calls to PxVehicleUpdates. |
Set the basis vectors of the vehicle simulation.
Default values PxVec3(0,1,0), PxVec3(0,0,1)
Call this function before using PxVehicleUpdates unless the default values are correct.
void PxVehicleSetMaxHitActorAcceleration | ( | const PxF32 | maxHitActorAcceleration | ) |
Determine the maximum acceleration experienced by PxRigidDynamic instances that are found to be in contact with a wheel.
Default value of maxHitActorAcceleration is PX_MAX_REAL
void PxVehicleSetSweepHitRejectionAngles | ( | const PxF32 | pointRejectAngle, | |
const PxF32 | normalRejectAngle | |||
) |
Set threshold angles that are used to determine if a wheel hit is to be resolved by vehicle suspension or by rigid body collision.
The diagram above depicts a wheel centered at "C" that has hit an inclined plane at point "X". The inclined plane has unit normal "N", while the suspension direction has unit vector "S". The unit vector from the wheel center to the hit point is "D". Hit points are analyzed by comparing the unit vectors D and N with the suspension direction S. This analysis is performed in the contact modification callback PxVehicleModifyWheelContacts (when enabled) and in PxVehicleUpdates (when non-blocking sweeps are enabled). If the angle between D and S is less than pointRejectAngle the hit is accepted by the suspension in PxVehicleUpdates and rejected by the contact modification callback PxVehicleModifyWheelContacts. If the angle between -N and S is less than normalRejectAngle the hit is accepted by the suspension in PxVehicleUpdates and rejected by the contact modification callback PxVehicleModifyWheelContacts.
pointRejectAngle | is the threshold angle used when comparing the angle between D and S. | |
normalRejectAngle | is the threshold angle used when comparing the angle between -N and S. |
Both angles have default values of Pi/4.
void PxVehicleSetUpdateMode | ( | PxVehicleUpdateMode::Enum | vehicleUpdateMode | ) |
Set the effect of PxVehicleUpdates to be either to modify each vehicle's rigid body actor.
with an acceleration to be applied in the next PhysX SDK update or as an immediate velocity modification.
Default behavior is immediate velocity modification.
Call this function before using PxVehicleUpdates for the first time if the default is not the desired behavior.
void PxVehicleShiftOrigin | ( | const PxVec3 & | shift, | |
const PxU32 | nbVehicles, | |||
PxVehicleWheels ** | vehicles | |||
) |
Shift the origin of vehicles by the specified vector.
Call this method to adjust the internal data structures of vehicles to reflect the shifted origin location (the shift vector will get subtracted from all world space spatial data).
This call will not automatically shift the PhysX scene and its objects. You need to call PxScene::shiftOrigin() seperately to keep the systems in sync.
[in] | shift | is the translation vector to shift the origin by. |
[in] | nbVehicles | is the number of vehicles in the vehicles array. |
[in,out] | vehicles | is an array of all vehicles that should be updated to map to the new scene origin. |
void PxVehicleSuspensionRaycasts | ( | PxBatchQuery * | batchQuery, | |
const PxU32 | nbVehicles, | |||
PxVehicleWheels ** | vehicles, | |||
const PxU32 | nbSceneQueryResults, | |||
PxRaycastQueryResult * | sceneQueryResults, | |||
const bool * | vehiclesToRaycast = NULL | |||
) |
Perform raycasts for all suspension lines for all vehicles.
[in] | batchQuery | is a PxBatchQuery instance used to specify shader data and functions for the raycast scene queries. |
[in] | nbVehicles | is the number of vehicles in the vehicles array. |
[in] | vehicles | is an array of all vehicles that are to have a raycast issued from each wheel. |
[in] | nbSceneQueryResults | must be greater than or equal to the total number of wheels of all the vehicles in the vehicles array; that is, sceneQueryResults must have dimensions large enough for one raycast hit result per wheel for all the vehicles in the vehicles array. |
[in] | sceneQueryResults | must persist without being overwritten until the end of the next PxVehicleUpdates call. |
[in] | vehiclesToRaycast | is an array of bools of length nbVehicles that is used to decide if raycasts will be performed for the corresponding vehicle in the vehicles array. If vehiclesToRaycast[i] is true then suspension line raycasts will be performed for vehicles[i]. If vehiclesToRaycast[i] is false then suspension line raycasts will not be performed for vehicles[i]. |
If vehiclesToRaycast[i] is false then the vehicle stored in vehicles[i] will automatically use the raycast or sweep hit planes recorded by the most recent suspension sweeps or raycasts for that vehicle. For vehicles far from the camera or not visible on the screen it can be optimal to only perform suspension line raycasts every Nth update rather than every single update. The accuracy of the cached contact plane naturally diminishes as N increase, meaning that wheels might start to hover or intersect the ground for large values of N or even with values close to 1 in conjunction with large vehicle speeds and/or geometry that has low spatial coherence.
Calling setToRestState invalidates any cached hit planes. Prior to calling PxVehicleUpdates each vehicle needs to perform suspension line raycasts or sweeps at least once after instantiation and at least once after calling setToRestState.
Each raycast casts along the suspension travel direction from the position of the top of the wheel at maximum suspension compression to the position of the base of the wheel at maximum droop. Raycasts that start inside a PxShape are subsequently ignored by the corresponding vehicle.
Only blocking hits are supported (PxQueryHitType::eBLOCK).
void PxVehicleSuspensionSweeps | ( | PxBatchQuery * | batchQuery, | |
const PxU32 | nbVehicles, | |||
PxVehicleWheels ** | vehicles, | |||
const PxU32 | nbSceneQueryResults, | |||
PxSweepQueryResult * | sceneQueryResults, | |||
const PxU16 | nbHitsPerQuery, | |||
const bool * | vehiclesToSweep = NULL , |
|||
const PxF32 | sweepWidthScale = 1.0f , |
|||
const PxF32 | sweepRadiusScale = 1.0f | |||
) |
Perform sweeps for all suspension lines for all vehicles.
[in] | batchQuery | is a PxBatchQuery instance used to specify shader data and functions for the sweep scene queries. |
[in] | nbVehicles | is the number of vehicles in the vehicles array. |
[in] | vehicles | is an array of all vehicles that are to have a sweep issued from each wheel. |
[in] | nbSceneQueryResults | must be greater than or equal to the total number of wheels of all the vehicles in the vehicles array; that is, sceneQueryResults must have dimensions large enough for one sweep hit result per wheel for all the vehicles in the vehicles array. |
[in] | sceneQueryResults | must persist without being overwritten until the end of the next PxVehicleUpdates call. |
[in] | nbHitsPerQuery | is the maximum numbers of hits that will be returned for each query. |
[in] | vehiclesToSweep | is an array of bools of length nbVehicles that is used to decide if sweeps will be performed for the corresponding vehicle in the vehicles array. If vehiclesToSweep[i] is true then suspension sweeps will be performed for vehicles[i]. If vehiclesToSweep[i] is false then suspension sweeps will not be performed for vehicles[i]. |
[in] | sweepWidthScale | scales the geometry of the wheel used in the sweep. Values < 1 result in a thinner swept wheel, while values > 1 result in a fatter swept wheel. |
[in] | sweepRadiusScale | scales the geometry of the wheel used in the sweep. Values < 1 result in a larger swept wheel, while values > 1 result in a smaller swept wheel. |
If vehiclesToSweep[i] is false then the vehicle stored in vehicles[i] will automatically use the most recent sweep or raycast hit planes recorded by the most recent suspension sweeps or raycasts for that vehicle. For vehicles far from the camera or not visible on the screen it can be optimal to only perform suspension queries every Nth update rather than every single update. The accuracy of the cached contact plane naturally diminishes as N increase, meaning that wheels might start to hover or intersect the ground for large values of N or even with values close to 1 in conjunction with large vehicle speeds and/or geometry that has low spatial coherence.
Calling setToRestState invalidates any cached hit planes. Prior to calling PxVehicleUpdates each vehicle needs to perform suspension raycasts or sweeps at least once after instantiation and at least once after calling setToRestState.
Each sweep casts the wheel's shape along the suspension travel direction from the position of the top of the wheel at maximum suspension compression to the position of the base of the wheel at maximum droop. Sweeps that start inside a PxShape are subsequently ignored by the corresponding vehicle.
A scale can be applied to the shape so that a modified shape is swept through the scene. The parameters sweepWidthScale and sweepRadiusScale scale the swept wheel shape in the width and radial directions. It is sometimes a good idea to sweep a thinner wheel to allow contact with other dynamic actors to be resolved first before attempting to drive on them.
Blocking hits (PxQueryHitType::eBLOCK) and non-blocking hits (PxQueryHitType::TOUCH) are supported. If the pre-and post-filter functions of the PxBatchQuery instance are set up to return blocking hits it is recommended to set nbHitsPerQuery = 1. If the filter functions returns touch hits then it is recommended to set nbHitsPerQuery > 1. The exact value depends on the expected complexity of the geometry that lies under the wheel. For complex geometry, especially with dynamic objects, it is recommended to use non-blocking hits. The vehicle update function will analyze all returned hits and choose the most appropriate using the thresholds set in PxVehicleSetSweepHitRejectionAngles.
void PxVehicleUpdateCMassLocalPose | ( | const PxTransform & | oldCMassLocalPose, | |
const PxTransform & | newCMassLocalPose, | |||
const PxU32 | gravityDirection, | |||
PxVehicleWheels * | vehicle | |||
) |
Reconfigure the vehicle to reflect a new center of mass local pose that has been applied to the actor. The function requires (i) the center of mass local pose that was last used to configure the vehicle and the vehicle's actor, (ii) the new center of mass local pose that has been applied to the vehicle's actor and will now be applied to the vehicle, and (iii) the direction of gravity (0 for x-axis, 1 for y-axis, 2 for z-axis).
[in] | oldCMassLocalPose | is the center of mass local pose that was last used to configure the vehicle. |
[in] | newCMassLocalPose | is the center of mass local pose that will be used to configure the vehicle so that it matches the vehicle's actor. |
[in] | gravityDirection | is an integer describing the direction of gravitational acceleration. A value of 0 corresponds to (0,0,-1), a value of 1 corresponds to (0,-1,0) and a value of 2 corresponds to (0,0,-1). |
[in,out] | vehicle | is the vehicle to be updated with a new center of mass local pose. |
The suspension sprung masses are updated so that the natural frequency and damping ratio of the springs are preserved. This involves altering the stiffness and damping rate of the suspension springs.
void PxVehicleUpdates | ( | const PxReal | timestep, | |
const PxVec3 & | gravity, | |||
const PxVehicleDrivableSurfaceToTireFrictionPairs & | vehicleDrivableSurfaceToTireFrictionPairs, | |||
const PxU32 | nbVehicles, | |||
PxVehicleWheels ** | vehicles, | |||
PxVehicleWheelQueryResult * | vehicleWheelQueryResults, | |||
PxVehicleConcurrentUpdateData * | vehicleConcurrentUpdates = NULL | |||
) |
Update an array of vehicles by either applying an acceleration to the rigid body actor associated with each vehicle or by an immediate update of the velocity of the actor.
[in] | timestep | is the timestep of the update |
[in] | gravity | is the value of gravitational acceleration |
[in] | vehicleDrivableSurfaceToTireFrictionPairs | describes the mapping between each PxMaterial ptr and an integer representing a surface type. It also stores the friction value for each combination of surface and tire type. |
[in] | nbVehicles | is the number of vehicles pointers in the vehicles array |
[in,out] | vehicles | is an array of length nbVehicles containing all vehicles to be updated by the specified timestep |
[out] | vehicleWheelQueryResults | is an array of length nbVehicles storing the wheel query results of each corresponding vehicle and wheel in the vehicles array. A NULL pointer is permitted. |
[out] | vehicleConcurrentUpdates | is an array of length nbVehicles. It is only necessary to specify vehicleConcurrentUpdates if PxVehicleUpdates is called concurrently. The element vehicleWheelQueryResults[i] of the array stores data that is computed for vehicle[i] during PxVehicleUpdates but which cannot be safely written when concurrently called. The data computed and stored in vehicleConcurrentUpdates must be passed to PxVehiclePostUpdates, where it is applied to all relevant actors in sequence. A NULL pointer is permitted. |
The vehicleWheelQueryResults buffer is left unmodified for vehicles with sleeping rigid bodies whose control inputs indicate they should remain inert.
If PxVehicleUpdates is called concurrently then vehicleConcurrentUpdates must be specified. Do not specify vehicleConcurrentUpdates is PxVehicleUpdates is not called concurrently.
The vehicleConcurrentUpdates buffer must persist until the end of PxVehiclePostUpdate.
If any vehicle has one or more disabled wheels (PxVehicleWheelsSimData::disableWheel) then the disabled wheels must not be associated with a PxShape (PxVehicleWheelsSimData::setWheelShapeMapping); the differential of the vehicle must be configured so that no drive torque is delivered to a disabled wheel; and the wheel must have zero rotation speed (PxVehicleWheelsDynData::setWheelRotationSpeed)
PxVehicleUpdates may be called concurrently provided all concurrent calls to PxVehicleUpdates involve only vehicles in the scene specified by PxVehicleUpdateSetScene. PxVehicleUpdates must never run concurrently with PxVehicleUpdateSingleVehicleAndStoreTelemetryData.