PxVehicleUpdate.h
Go to the documentation of this file.
1 //
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions
4 // are met:
5 // * Redistributions of source code must retain the above copyright
6 // notice, this list of conditions and the following disclaimer.
7 // * Redistributions in binary form must reproduce the above copyright
8 // notice, this list of conditions and the following disclaimer in the
9 // documentation and/or other materials provided with the distribution.
10 // * Neither the name of NVIDIA CORPORATION nor the names of its
11 // contributors may be used to endorse or promote products derived
12 // from this software without specific prior written permission.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
15 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.
27 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
28 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
29 
30 #ifndef PX_VEHICLE_UPDATE_H
31 #define PX_VEHICLE_UPDATE_H
32 
36 #include "vehicle/PxVehicleSDK.h"
39 #include "foundation/PxMemory.h"
40 #include "foundation/PxTransform.h"
41 #include "PxBatchQueryDesc.h"
42 
43 #if !PX_DOXYGEN
44 namespace physx
45 {
46 #endif
47 
48  class PxBatchQuery;
49  class PxContactModifyPair;
50  class PxVehicleWheels;
52  class PxVehicleTelemetryData;
53 
60  {
62  {
63  PxMemZero(this, sizeof(PxWheelQueryResult));
64  isInAir=true;
66  localPose = PxTransform(PxIdentity);
67  }
68 
75 
82 
89 
96  bool isInAir;
97 
104 
111 
118 
129 
136 
143 
153 
163 
172 
180 
188 
198 
208 
214 
219  };
220 
222  {
232 
238  };
239 
247  {
248  friend class PxVehicleUpdate;
249 
251  : localPose(PxTransform(PxIdentity)),
252  hitActor(NULL),
253  hitActorForce(PxVec3(0,0,0)),
254  hitActorForcePosition(PxVec3(0,0,0))
255  {
256  }
257 
258  private:
259 
264  };
265 
274  {
275  friend class PxVehicleUpdate;
276 
278  : concurrentWheelUpdates(NULL),
279  nbConcurrentWheelUpdates(0),
280  linearMomentumChange(PxVec3(0,0,0)),
281  angularMomentumChange(PxVec3(0,0,0)),
282  staySleeping(false),
283  wakeup(false)
284  {
285  }
286 
294 
300 
301  private:
302 
306  bool wakeup;
307  };
308 
347  (PxBatchQuery* batchQuery,
348  const PxU32 nbVehicles, PxVehicleWheels** vehicles,
349  const PxU32 nbSceneQueryResults, PxRaycastQueryResult* sceneQueryResults,
350  const bool* vehiclesToRaycast = NULL);
351 
352 
409  (PxBatchQuery* batchQuery,
410  const PxU32 nbVehicles, PxVehicleWheels** vehicles,
411  const PxU32 nbSceneQueryResults, PxSweepQueryResult* sceneQueryResults, const PxU16 nbHitsPerQuery,
412  const bool* vehiclesToSweep = NULL,
413  const PxF32 sweepWidthScale = 1.0f, const PxF32 sweepRadiusScale = 1.0f);
414 
448  (const PxVehicleWheels& vehicle, const PxU32 wheelId,
449  const PxF32 wheelTangentVelocityMultiplier, const PxReal maxImpulse,
450  PxContactModifyPair& contactModifyPair);
451 
452 
497  void PxVehicleUpdates(
498  const PxReal timestep, const PxVec3& gravity,
499  const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs,
500  const PxU32 nbVehicles, PxVehicleWheels** vehicles, PxVehicleWheelQueryResult* vehicleWheelQueryResults, PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates = NULL);
501 
502 
516  const PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates, const PxU32 nbVehicles, PxVehicleWheels** vehicles);
517 
518 
535  void PxVehicleShiftOrigin(const PxVec3& shift, const PxU32 nbVehicles, PxVehicleWheels** vehicles);
536 
537 #if PX_DEBUG_VEHICLE_ON
538 
567  void PxVehicleUpdateSingleVehicleAndStoreTelemetryData
568  (const PxReal timestep, const PxVec3& gravity,
569  const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs,
570  PxVehicleWheels* focusVehicle, PxVehicleWheelQueryResult* vehicleWheelQueryResults,
571  PxVehicleTelemetryData& telemetryData);
572 #endif
573 
574 #if !PX_DOXYGEN
575 } // namespace physx
576 #endif
577 
579 #endif //PX_VEHICLE_UPDATE_H
Definition: GuContactBuffer.h:37
PxVehicleWheelConcurrentUpdateData()
Definition: PxVehicleUpdate.h:250
bool isInAir
If suspension travel limits forbid the wheel from touching the drivable surface then isInAir is true...
Definition: PxVehicleUpdate.h:96
PxReal steerAngle
Steer angle of the wheel about the "up" vector accounting for input steer and toe and...
Definition: PxVehicleUpdate.h:213
PX_DEPRECATED PxBatchQueryResult< PxSweepHit > PxSweepQueryResult
Convenience typedef for the result of a batched sweep query.
Definition: PxBatchQueryDesc.h:105
Friction for each combination of driving surface type and tire type.
Definition: PxVehicleTireFriction.h:62
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.
Definition: Px.h:84
An array of instances of this class is passed to PxContactModifyCallback::onContactModify().
Definition: PxContactModifyCallback.h:367
PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK.
Definition: PxRigidDynamic.h:83
PxVec3 hitActorForcePosition
Definition: PxVehicleUpdate.h:263
float PxF32
Definition: PxSimpleTypes.h:76
PxReal maxImpulse
maximum impulse the solver may apply to enforce this constraint
Definition: PxConstraintDesc.h:93
PxReal longitudinalSlip
Longitudinal slip of the tire.
Definition: PxVehicleUpdate.h:197
PxVec3 suspLineDir
Directions of suspension line raycast/sweep used in the raycast/sweep completed immediately before Px...
Definition: PxVehicleUpdate.h:81
PxActor is the base class for the main simulation objects in the physics SDK.
Definition: PxActor.h:154
PxVec3 tireLongitudinalDir
Forward direction of the wheel/tire accounting for steer/toe/camber angle projected on to the contact...
Definition: PxVehicleUpdate.h:179
Abstract class for collision shapes.
Definition: PxShape.h:142
Batched queries object. This is used to perform several queries at the same time. ...
Definition: PxBatchQuery.h:57
float PxReal
Definition: PxSimpleTypes.h:78
uint32_t PxU32
Definition: PxSimpleTypes.h:71
PX_DEPRECATED PxBatchQueryResult< PxRaycastHit > PxRaycastQueryResult
Convenience typedef for the result of a batched raycast query.
Definition: PxBatchQueryDesc.h:102
PxTransform localPose
Definition: PxVehicleUpdate.h:260
PxVec3 hitActorForce
Definition: PxVehicleUpdate.h:262
Definition: PxVehicleUpdate.h:221
PxU32 nbConcurrentWheelUpdates
The length of the concurrentWheelUpdates buffer. This value corresponds to the number of wheels in th...
Definition: PxVehicleUpdate.h:299
bool wakeup
Definition: PxVehicleUpdate.h:306
const PxMaterial * tireSurfaceMaterial
PxMaterial instance of the driving surface under the corresponding vehicle wheel. ...
Definition: PxVehicleUpdate.h:117
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 bod...
Structure containing data that is computed for a vehicle and its wheels during concurrent calls to Px...
Definition: PxVehicleUpdate.h:273
PxTransform localPose
Local pose of the wheel.
Definition: PxVehicleUpdate.h:218
PxReal suspLineLength
Lengths of suspension line raycast/sweep used in raycast/sweep completed immediately before PxVehicle...
Definition: PxVehicleUpdate.h:88
PxVec3 angularMomentumChange
Definition: PxVehicleUpdate.h:304
PxWheelQueryResult * wheelQueryResults
Pointer to an PxWheelQueryResult buffer of length nbWheelQueryResults The wheelQueryResults buffer mu...
Definition: PxVehicleUpdate.h:231
PxWheelQueryResult()
Definition: PxVehicleUpdate.h:61
PxU32 nbWheelQueryResults
The length of the wheelQueryResults buffer. This value corresponds to the number of wheels in the ass...
Definition: PxVehicleUpdate.h:237
PxRigidDynamic * hitActor
Definition: PxVehicleUpdate.h:261
bool staySleeping
Definition: PxVehicleUpdate.h:305
class representing a rigid euclidean transform as a quaternion and a vector
Definition: PxTransform.h:48
PxReal suspJounce
Compression of the suspension spring.
Definition: PxVehicleUpdate.h:162
PxU32 tireSurfaceType
Surface type integer that corresponds to the mapping between tireSurfaceMaterial and integer as descr...
Definition: PxVehicleUpdate.h:128
PxVec3 tireContactPoint
Point on the drivable surface hit by the most recent suspension raycast or sweep. ...
Definition: PxVehicleUpdate.h:135
PxReal suspSpringForce
Magnitude of force applied by the suspension spring along the direction of suspension travel...
Definition: PxVehicleUpdate.h:171
PxReal lateralSlip
Lateral slip of the tire.
Definition: PxVehicleUpdate.h:207
PxShape * tireContactShape
PxShape instance of the driving surface under the corresponding vehicle wheel.
Definition: PxVehicleUpdate.h:110
Data structure with instanced dynamics data and configuration data of a vehicle with just wheels...
Definition: PxVehicleWheels.h:676
PxVec3 suspLineStart
Start point of suspension line raycast/sweep used in the raycast/sweep completed immediately before P...
Definition: PxVehicleUpdate.h:74
Material class to represent a set of surface properties.
Definition: PxMaterial.h:130
PxVehicleWheelConcurrentUpdateData * concurrentWheelUpdates
Pointer to an PxVehicleWheelConcurrentUpdate buffer of length nbConcurrentWheelUpdates The concurrent...
Definition: PxVehicleUpdate.h:293
PxReal tireFriction
Friction experienced by the tire for the combination of tire type and surface type after accounting f...
Definition: PxVehicleUpdate.h:152
PxVehicleConcurrentUpdateData()
Definition: PxVehicleUpdate.h:277
PxVec3 linearMomentumChange
Definition: PxVehicleUpdate.h:303
PxVec3 tireLateralDir
Lateral direction of the wheel/tire accounting for steer/toe/camber angle projected on to the contact...
Definition: PxVehicleUpdate.h:187
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.
uint16_t PxU16
Definition: PxSimpleTypes.h:73
PxVec3 tireContactNormal
Normal on the drivable surface at the hit point of the most recent suspension raycast or sweep...
Definition: PxVehicleUpdate.h:142
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 wit...
uint32_t PxU32
Definition: Px.h:48
Structure containing data describing the non-persistent state of each suspension/wheel/tire unit...
Definition: PxVehicleUpdate.h:59
PX_FORCE_INLINE void * PxMemZero(void *dest, PxU32 count)
Sets the bytes of the provided buffer to zero.
Definition: PxMemory.h:54
Definition: PxVehicleTireFriction.h:53
PxActor * tireContactActor
PxActor instance of the driving surface under the corresponding vehicle wheel.
Definition: PxVehicleUpdate.h:103
Structure containing data that is computed for a wheel during concurrent calls to PxVehicleUpdates bu...
Definition: PxVehicleUpdate.h:246
3 Element vector class.
Definition: PxVec3.h:49
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...
void PxVehicleShiftOrigin(const PxVec3 &shift, const PxU32 nbVehicles, PxVehicleWheels **vehicles)
Shift the origin of vehicles by the specified vector.