MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / updateDriveNW

Method updateDriveNW

physx/source/physxvehicle/src/PxVehicleUpdate.cpp:5371–5887  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5369}
5370
5371void PxVehicleUpdate::updateDriveNW
5372(const PxF32 timestep,
5373 const PxVec3& gravity, const PxF32 gravityMagnitude, const PxF32 recipGravityMagnitude,
5374 const PxVehicleDrivableSurfaceToTireFrictionPairs& drivableSurfaceToTireFrictionPairs,
5375 PxVehicleDriveNW* vehDriveNW, PxVehicleWheelQueryResult* vehWheelQueryResults, PxVehicleConcurrentUpdateData* vehConcurrentUpdates)
5376{
5377 PX_SIMD_GUARD; // denorm exception triggered in transformInertiaTensor() on osx
5378
5379 START_TIMER(TIMER_ADMIN);
5380
5381 PX_CHECK_AND_RETURN(
5382 vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_ACCEL]>-0.01f &&
5383 vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_ACCEL]<1.01f,
5384 "Illegal vehicle control value - accel must be in range (0,1)");
5385 PX_CHECK_AND_RETURN(
5386 vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_BRAKE]>-0.01f &&
5387 vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_BRAKE]<1.01f,
5388 "Illegal vehicle control value - brake must be in range (0,1)");
5389 PX_CHECK_AND_RETURN(
5390 vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_HANDBRAKE]>-0.01f &&
5391 vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_HANDBRAKE]<1.01f,
5392 "Illegal vehicle control value - handbrake must be in range (0,1)");
5393 PX_CHECK_AND_RETURN(
5394 vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_STEER_LEFT]>-1.01f &&
5395 vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_STEER_LEFT]<1.01f,
5396 "Illegal vehicle control value - left steer must be in range (-1,1)");
5397 PX_CHECK_AND_RETURN(
5398 vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_STEER_RIGHT]>-1.01f &&
5399 vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_STEER_RIGHT]<1.01f,
5400 "Illegal vehicle control value - right steer must be in range (-1,1)");
5401 PX_CHECK_AND_RETURN(
5402 PxAbs(vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_STEER_RIGHT]-
5403 vehDriveNW->mDriveDynData.mControlAnalogVals[PxVehicleDriveNWControl::eANALOG_INPUT_STEER_LEFT])<1.01f,
5404 "Illegal vehicle control value - right steer value minus left steer value must be in range (-1,1)");
5405 PX_CHECK_AND_RETURN(
5406 !(vehDriveNW->getRigidDynamicActor()->getRigidBodyFlags() & PxRigidBodyFlag::eKINEMATIC),
5407 "Attempting to update a drive4W with a kinematic actor - this isn't allowed");
5408 PX_CHECK_AND_RETURN(
5409 NULL==vehWheelQueryResults || vehWheelQueryResults->nbWheelQueryResults >= vehDriveNW->mWheelsSimData.getNbWheels(),
5410 "nbWheelQueryResults must always be greater than or equal to number of wheels in corresponding vehicle");
5411
5412#if PX_CHECKED
5413 for(PxU32 i=0;i<vehDriveNW->mWheelsSimData.getNbWheels();i++)
5414 {
5415 PX_CHECK_AND_RETURN(!vehDriveNW->mWheelsSimData.getIsWheelDisabled(i) || !vehDriveNW->mDriveSimData.getDiffData().getIsDrivenWheel(i),
5416 "PxVehicleDifferentialNWData must be configured so that no torque is delivered to a disabled wheel");
5417 }
5418#endif
5419
5420 END_TIMER(TIMER_ADMIN);
5421 START_TIMER(TIMER_GRAPHS);
5422
5423#if PX_DEBUG_VEHICLE_ON
5424 for(PxU32 i=0;i<vehDriveNW->mWheelsSimData.mNbWheels4;i++)
5425 {
5426 updateGraphDataInternalWheelDynamics(4*i,vehDriveNW->mWheelsDynData.mWheels4DynData[i].mWheelSpeeds);
5427 }
5428 updateGraphDataInternalEngineDynamics(vehDriveNW->mDriveDynData.getEngineRotationSpeed());

Callers

nothing calls this directly

Calls 15

START_TIMERFunction · 0.85
PxAbsFunction · 0.85
END_TIMERFunction · 0.85
PxMinFunction · 0.85
processAutoBoxFunction · 0.85
processGearsFunction · 0.85
computeClutchStrengthFunction · 0.85
computeGearRatioFunction · 0.85
updateGraphDataGearRatioFunction · 0.85

Tested by

no test coverage detected