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-2021 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 
98  bool isInAir;
99 
106 
113 
120 
131 
138 
145 
155 
165 
174 
182 
190 
200 
210 
216 
221  };
222 
224  {
234 
240  };
241 
249  {
250  friend class PxVehicleUpdate;
251 
253  : localPose(PxTransform(PxIdentity)),
254  hitActor(NULL),
255  hitActorForce(PxVec3(0,0,0)),
256  hitActorForcePosition(PxVec3(0,0,0))
257  {
258  }
259 
260  private:
261 
266  };
267 
276  {
277  friend class PxVehicleUpdate;
278 
280  : concurrentWheelUpdates(NULL),
281  nbConcurrentWheelUpdates(0),
282  linearMomentumChange(PxVec3(0,0,0)),
283  angularMomentumChange(PxVec3(0,0,0)),
284  staySleeping(false),
285  wakeup(false)
286  {
287  }
288 
296 
302 
303  private:
304 
308  bool wakeup;
309  };
310 
349  (PxBatchQuery* batchQuery,
350  const PxU32 nbVehicles, PxVehicleWheels** vehicles,
351  const PxU32 nbSceneQueryResults, PxRaycastQueryResult* sceneQueryResults,
352  const bool* vehiclesToRaycast = NULL);
353 
354 
414  (PxBatchQuery* batchQuery,
415  const PxU32 nbVehicles, PxVehicleWheels** vehicles,
416  const PxU32 nbSceneQueryResults, PxSweepQueryResult* sceneQueryResults, const PxU16 nbHitsPerQuery,
417  const bool* vehiclesToSweep = NULL,
418  const PxF32 sweepWidthScale = 1.0f, const PxF32 sweepRadiusScale = 1.0f, const PxF32 sweepInflation = 0.0f);
419 
453  (const PxVehicleWheels& vehicle, const PxU32 wheelId,
454  const PxF32 wheelTangentVelocityMultiplier, const PxReal maxImpulse,
455  PxContactModifyPair& contactModifyPair);
456 
457 
502  void PxVehicleUpdates(
503  const PxReal timestep, const PxVec3& gravity,
504  const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs,
505  const PxU32 nbVehicles, PxVehicleWheels** vehicles, PxVehicleWheelQueryResult* vehicleWheelQueryResults, PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates = NULL);
506 
507 
523  const PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates, const PxU32 nbVehicles, PxVehicleWheels** vehicles);
524 
525 
542  void PxVehicleShiftOrigin(const PxVec3& shift, const PxU32 nbVehicles, PxVehicleWheels** vehicles);
543 
544 #if PX_DEBUG_VEHICLE_ON
545 
581  void PxVehicleUpdateSingleVehicleAndStoreTelemetryData
582  (const PxReal timestep, const PxVec3& gravity,
583  const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs,
584  PxVehicleWheels* focusVehicle, PxVehicleWheelQueryResult* vehicleWheelQueryResults,
585  PxVehicleTelemetryData& telemetryData,
586  PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates = NULL);
587 #endif
588 
589 #if !PX_DOXYGEN
590 } // namespace physx
591 #endif
592 
594 #endif //PX_VEHICLE_UPDATE_H
Definition: GuContactBuffer.h:37
PxVehicleWheelConcurrentUpdateData()
Definition: PxVehicleUpdate.h:252
bool isInAir
If suspension travel limits forbid the wheel from touching the drivable surface then isInAir is true...
Definition: PxVehicleUpdate.h:98
PxReal steerAngle
Steer angle of the wheel about the "up" vector accounting for input steer and toe and...
Definition: PxVehicleUpdate.h:215
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
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:265
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:199
Definition: PxVehicleTireFriction.h:53
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:181
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:262
PxVec3 hitActorForce
Definition: PxVehicleUpdate.h:264
Definition: PxVehicleUpdate.h:223
PxU32 nbConcurrentWheelUpdates
The length of the concurrentWheelUpdates buffer. This value corresponds to the number of wheels in th...
Definition: PxVehicleUpdate.h:301
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, const PxF32 sweepInflation=0.0f)
Perform sweeps for all suspension lines for all vehicles.
bool wakeup
Definition: PxVehicleUpdate.h:308
const PxMaterial * tireSurfaceMaterial
PxMaterial instance of the driving surface under the corresponding vehicle wheel. ...
Definition: PxVehicleUpdate.h:119
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:275
PxTransform localPose
Local pose of the wheel.
Definition: PxVehicleUpdate.h:220
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:306
PxWheelQueryResult * wheelQueryResults
Pointer to an PxWheelQueryResult buffer of length nbWheelQueryResults The wheelQueryResults buffer mu...
Definition: PxVehicleUpdate.h:233
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:239
PxRigidDynamic * hitActor
Definition: PxVehicleUpdate.h:263
bool staySleeping
Definition: PxVehicleUpdate.h:307
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:164
PxU32 tireSurfaceType
Surface type integer that corresponds to the mapping between tireSurfaceMaterial and integer as descr...
Definition: PxVehicleUpdate.h:130
PxVec3 tireContactPoint
Point on the drivable surface hit by the most recent suspension raycast or sweep. ...
Definition: PxVehicleUpdate.h:137
PxReal suspSpringForce
Magnitude of force applied by the suspension spring along the direction of suspension travel...
Definition: PxVehicleUpdate.h:173
PxReal lateralSlip
Lateral slip of the tire.
Definition: PxVehicleUpdate.h:209
PxShape * tireContactShape
PxShape instance of the driving surface under the corresponding vehicle wheel.
Definition: PxVehicleUpdate.h:112
Data structure with instanced dynamics data and configuration data of a vehicle with just wheels...
Definition: PxVehicleWheels.h:790
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:143
PxVehicleWheelConcurrentUpdateData * concurrentWheelUpdates
Pointer to an PxVehicleWheelConcurrentUpdate buffer of length nbConcurrentWheelUpdates The concurrent...
Definition: PxVehicleUpdate.h:295
PxReal tireFriction
Friction experienced by the tire for the combination of tire type and surface type after accounting f...
Definition: PxVehicleUpdate.h:154
PxVehicleConcurrentUpdateData()
Definition: PxVehicleUpdate.h:279
PxVec3 linearMomentumChange
Definition: PxVehicleUpdate.h:305
PxVec3 tireLateralDir
Lateral direction of the wheel/tire accounting for steer/toe/camber angle projected on to the contact...
Definition: PxVehicleUpdate.h:189
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:144
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
PxActor * tireContactActor
PxActor instance of the driving surface under the corresponding vehicle wheel.
Definition: PxVehicleUpdate.h:105
Structure containing data that is computed for a wheel during concurrent calls to PxVehicleUpdates or...
Definition: PxVehicleUpdate.h:248
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 or PxVehicleUpdateSing...
void PxVehicleShiftOrigin(const PxVec3 &shift, const PxU32 nbVehicles, PxVehicleWheels **vehicles)
Shift the origin of vehicles by the specified vector.