00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef PX_VEHICLE_UPDATE_H
00031 #define PX_VEHICLE_UPDATE_H
00032
00036 #include "vehicle/PxVehicleSDK.h"
00037 #include "vehicle/PxVehicleTireFriction.h"
00038 #include "foundation/PxSimpleTypes.h"
00039 #include "foundation/PxMemory.h"
00040 #include "foundation/PxTransform.h"
00041 #include "PxBatchQueryDesc.h"
00042
00043 #if !PX_DOXYGEN
00044 namespace physx
00045 {
00046 #endif
00047
00048 class PxBatchQuery;
00049 class PxContactModifyPair;
00050 class PxVehicleWheels;
00051 class PxVehicleDrivableSurfaceToTireFrictionPairs;
00052 class PxVehicleTelemetryData;
00053
00059 struct PxWheelQueryResult
00060 {
00061 PxWheelQueryResult()
00062 {
00063 PxMemZero(this, sizeof(PxWheelQueryResult));
00064 isInAir=true;
00065 tireSurfaceType = PxU32(PxVehicleDrivableSurfaceType::eSURFACE_TYPE_UNKNOWN);
00066 localPose = PxTransform(PxIdentity);
00067 }
00068
00074 PxVec3 suspLineStart;
00075
00081 PxVec3 suspLineDir;
00082
00088 PxReal suspLineLength;
00089
00096 bool isInAir;
00097
00103 PxActor* tireContactActor;
00104
00110 PxShape* tireContactShape;
00111
00117 const PxMaterial* tireSurfaceMaterial;
00118
00128 PxU32 tireSurfaceType;
00129
00135 PxVec3 tireContactPoint;
00136
00142 PxVec3 tireContactNormal;
00143
00152 PxReal tireFriction;
00153
00162 PxReal suspJounce;
00163
00171 PxReal suspSpringForce;
00172
00179 PxVec3 tireLongitudinalDir;
00180
00187 PxVec3 tireLateralDir;
00188
00197 PxReal longitudinalSlip;
00198
00207 PxReal lateralSlip;
00208
00213 PxReal steerAngle;
00214
00218 PxTransform localPose;
00219 };
00220
00221 struct PxVehicleWheelQueryResult
00222 {
00231 PxWheelQueryResult* wheelQueryResults;
00232
00237 PxU32 nbWheelQueryResults;
00238 };
00239
00246 struct PxVehicleWheelConcurrentUpdateData
00247 {
00248 friend class PxVehicleUpdate;
00249
00250 PxVehicleWheelConcurrentUpdateData()
00251 : localPose(PxTransform(PxIdentity)),
00252 hitActor(NULL),
00253 hitActorForce(PxVec3(0,0,0)),
00254 hitActorForcePosition(PxVec3(0,0,0))
00255 {
00256 }
00257
00258 private:
00259
00260 PxTransform localPose;
00261 PxRigidDynamic* hitActor;
00262 PxVec3 hitActorForce;
00263 PxVec3 hitActorForcePosition;
00264 };
00265
00273 struct PxVehicleConcurrentUpdateData
00274 {
00275 friend class PxVehicleUpdate;
00276
00277 PxVehicleConcurrentUpdateData()
00278 : concurrentWheelUpdates(NULL),
00279 nbConcurrentWheelUpdates(0),
00280 linearMomentumChange(PxVec3(0,0,0)),
00281 angularMomentumChange(PxVec3(0,0,0)),
00282 staySleeping(false),
00283 wakeup(false)
00284 {
00285 }
00286
00293 PxVehicleWheelConcurrentUpdateData* concurrentWheelUpdates;
00294
00299 PxU32 nbConcurrentWheelUpdates;
00300
00301 private:
00302
00303 PxVec3 linearMomentumChange;
00304 PxVec3 angularMomentumChange;
00305 bool staySleeping;
00306 bool wakeup;
00307 };
00308
00346 void PxVehicleSuspensionRaycasts
00347 (PxBatchQuery* batchQuery,
00348 const PxU32 nbVehicles, PxVehicleWheels** vehicles,
00349 const PxU32 nbSceneQueryResults, PxRaycastQueryResult* sceneQueryResults,
00350 const bool* vehiclesToRaycast = NULL);
00351
00352
00408 void PxVehicleSuspensionSweeps
00409 (PxBatchQuery* batchQuery,
00410 const PxU32 nbVehicles, PxVehicleWheels** vehicles,
00411 const PxU32 nbSceneQueryResults, PxSweepQueryResult* sceneQueryResults, const PxU16 nbHitsPerQuery,
00412 const bool* vehiclesToSweep = NULL,
00413 const PxF32 sweepWidthScale = 1.0f, const PxF32 sweepRadiusScale = 1.0f);
00414
00447 PxU32 PxVehicleModifyWheelContacts
00448 (const PxVehicleWheels& vehicle, const PxU32 wheelId,
00449 const PxF32 wheelTangentVelocityMultiplier, const PxReal maxImpulse,
00450 PxContactModifyPair& contactModifyPair);
00451
00452
00497 void PxVehicleUpdates(
00498 const PxReal timestep, const PxVec3& gravity,
00499 const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs,
00500 const PxU32 nbVehicles, PxVehicleWheels** vehicles, PxVehicleWheelQueryResult* vehicleWheelQueryResults, PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates = NULL);
00501
00502
00515 void PxVehiclePostUpdates(
00516 const PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates, const PxU32 nbVehicles, PxVehicleWheels** vehicles);
00517
00518
00535 void PxVehicleShiftOrigin(const PxVec3& shift, const PxU32 nbVehicles, PxVehicleWheels** vehicles);
00536
00537 #if PX_DEBUG_VEHICLE_ON
00538
00567 void PxVehicleUpdateSingleVehicleAndStoreTelemetryData
00568 (const PxReal timestep, const PxVec3& gravity,
00569 const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs,
00570 PxVehicleWheels* focusVehicle, PxVehicleWheelQueryResult* vehicleWheelQueryResults,
00571 PxVehicleTelemetryData& telemetryData);
00572 #endif
00573
00574 #if !PX_DOXYGEN
00575 }
00576 #endif
00577
00579 #endif //PX_VEHICLE_UPDATE_H