RavEngine
Loading...
Searching...
No Matches
PxVehicleUpdate.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef PX_VEHICLE_UPDATE_H
30#define PX_VEHICLE_UPDATE_H
31
32#include "vehicle/PxVehicleSDK.h"
33#include "vehicle/PxVehicleTireFriction.h"
34#include "foundation/PxSimpleTypes.h"
35#include "foundation/PxMemory.h"
36#include "foundation/PxTransform.h"
37#include "PxQueryFiltering.h"
38
39#if !PX_DOXYGEN
40namespace physx
41{
42#endif
43
44 class PxContactModifyPair;
45 class PxVehicleWheels;
46 class PxVehicleDrivableSurfaceToTireFrictionPairs;
47 class PxVehicleTelemetryData;
48 class PxBatchQueryExt;
49
56 {
58 {
59 PxMemZero(this, sizeof(PxWheelQueryResult));
60 isInAir=true;
61 tireSurfaceType = PxU32(PxVehicleDrivableSurfaceType::eSURFACE_TYPE_UNKNOWN);
62 localPose = PxTransform(PxIdentity);
63 }
64
71
78
85
94 bool isInAir;
95
102
109
116
127
134
141
151
161
170
178
186
196
206
212
217 };
218
237
245 {
246 friend class PxVehicleUpdate;
247
249 : localPose(PxTransform(PxIdentity)),
250 hitActor(NULL),
251 hitActorForce(PxVec3(0,0,0)),
252 hitActorForcePosition(PxVec3(0,0,0))
253 {
254 }
255
256 private:
257
258 PxTransform localPose;
259 PxRigidDynamic* hitActor;
260 PxVec3 hitActorForce;
261 PxVec3 hitActorForcePosition;
262 };
263
272 {
273 friend class PxVehicleUpdate;
274
276 : concurrentWheelUpdates(NULL),
277 nbConcurrentWheelUpdates(0),
278 linearMomentumChange(PxVec3(0,0,0)),
279 angularMomentumChange(PxVec3(0,0,0)),
280 staySleeping(false),
281 wakeup(false)
282 {
283 }
284
292
298
299 private:
300
301 PxVec3 linearMomentumChange;
302 PxVec3 angularMomentumChange;
303 bool staySleeping;
304 bool wakeup;
305 };
306
344 const PxU32 nbVehicles, PxVehicleWheels** vehicles,
345 const bool* vehiclesToRaycast = NULL,
347
406 const PxU32 nbVehicles, PxVehicleWheels** vehicles,
407 const PxU16 nbHitsPerQuery,
408 const bool* vehiclesToSweep = NULL,
409 const PxF32 sweepWidthScale = 1.0f, const PxF32 sweepRadiusScale = 1.0f, const PxF32 sweepInflation = 0.0f,
412
448 (const PxVehicleWheels& vehicle, const PxU32 wheelId,
449 const PxF32 wheelTangentVelocityMultiplier, const PxReal maxImpulse,
450 PxContactModifyPair& contactModifyPair,
452
453
501 const PxReal timestep, const PxVec3& gravity,
502 const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs,
503 const PxU32 nbVehicles, PxVehicleWheels** vehicles, PxVehicleWheelQueryResult* vehicleWheelQueryResults, PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates = NULL,
505
506
524 const PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates, const PxU32 nbVehicles, PxVehicleWheels** vehicles,
526
527
544 PX_DEPRECATED void PxVehicleShiftOrigin(const PxVec3& shift, const PxU32 nbVehicles, PxVehicleWheels** vehicles);
545
546#if PX_DEBUG_VEHICLE_ON
585 PX_DEPRECATED void PxVehicleUpdateSingleVehicleAndStoreTelemetryData
586 (const PxReal timestep, const PxVec3& gravity,
587 const PxVehicleDrivableSurfaceToTireFrictionPairs& vehicleDrivableSurfaceToTireFrictionPairs,
588 PxVehicleWheels* focusVehicle, PxVehicleWheelQueryResult* vehicleWheelQueryResults,
589 PxVehicleTelemetryData& telemetryData,
590 PxVehicleConcurrentUpdateData* vehicleConcurrentUpdates = NULL,
592#endif
593
594#if !PX_DOXYGEN
595} // namespace physx
596#endif
597
598#endif
Definition base.h:1940
PxActor is the base class for the main simulation objects in the physics SDK.
Definition PxActor.h:201
Definition PxSceneQueryExt.h:337
An array of instances of this class is passed to PxContactModifyCallback::onContactModify().
Definition PxContactModifyCallback.h:408
Material class to represent a set of surface properties.
Definition PxMaterial.h:149
PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK.
Definition PxRigidDynamic.h:82
Abstract class for collision shapes.
Definition PxShape.h:146
class representing a rigid euclidean transform as a quaternion and a vector
Definition PxTransform.h:49
3 Element vector class.
Definition PxVec3.h:50
Common parameters and settings used for the vehicle simulation.
Definition PxVehicleSDK.h:244
Friction for each combination of driving surface type and tire type.
Definition PxVehicleTireFriction.h:62
Definition PxVehicleUpdate.cpp:4519
Data structure with instanced dynamics data and configuration data of a vehicle with just wheels.
Definition PxVehicleWheels.h:827
#define PX_DEPRECATED
Definition PxPreprocessor.h:418
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PX_DEPRECATED PxU32 PxVehicleModifyWheelContacts(const PxVehicleWheels &vehicle, const PxU32 wheelId, const PxF32 wheelTangentVelocityMultiplier, const PxReal maxImpulse, PxContactModifyPair &contactModifyPair, const PxVehicleContext &context=PxVehicleGetDefaultContext())
A function called from PxContactModifyCallback::onContactModify. The function determines if rigid bod...
Definition PxVehicleUpdate.cpp:404
PX_FORCE_INLINE void * PxMemZero(void *dest, PxU32 count)
Sets the bytes of the provided buffer to zero.
Definition PxMemory.h:53
PX_DEPRECATED void PxVehicleSuspensionSweeps(PxBatchQueryExt *batchQuery, const PxU32 nbVehicles, PxVehicleWheels **vehicles, const PxU16 nbHitsPerQuery, const bool *vehiclesToSweep=NULL, const PxF32 sweepWidthScale=1.0f, const PxF32 sweepRadiusScale=1.0f, const PxF32 sweepInflation=0.0f, const PxQueryFlags queryFlags=PxQueryFlag::eSTATIC|PxQueryFlag::eDYNAMIC|PxQueryFlag::ePREFILTER, const PxVehicleContext &context=PxVehicleGetDefaultContext())
Perform sweeps for all suspension lines for all vehicles.
Definition PxVehicleUpdate.cpp:7497
PX_DEPRECATED void PxVehiclePostUpdates(const PxVehicleConcurrentUpdateData *vehicleConcurrentUpdates, const PxU32 nbVehicles, PxVehicleWheels **vehicles, const PxVehicleContext &context=PxVehicleGetDefaultContext())
Apply actor changes that were computed in concurrent calls to PxVehicleUpdates or PxVehicleUpdateSing...
Definition PxVehicleUpdate.cpp:7097
PX_DEPRECATED void PxVehicleSuspensionRaycasts(PxBatchQueryExt *batchQuery, const PxU32 nbVehicles, PxVehicleWheels **vehicles, const bool *vehiclesToRaycast=NULL, const PxQueryFlags queryFlags=PxQueryFlag::eSTATIC|PxQueryFlag::eDYNAMIC|PxQueryFlag::ePREFILTER)
Perform raycasts for all suspension lines for all vehicles.
Definition PxVehicleUpdate.cpp:7260
PX_DEPRECATED const PxVehicleContext & PxVehicleGetDefaultContext()
Get the default vehicle context.
Definition PxVehicleUpdate.cpp:120
PX_DEPRECATED void PxVehicleShiftOrigin(const PxVec3 &shift, const PxU32 nbVehicles, PxVehicleWheels **vehicles)
Shift the origin of vehicles by the specified vector.
Definition PxVehicleUpdate.cpp:7105
PX_DEPRECATED void PxVehicleUpdates(const PxReal timestep, const PxVec3 &gravity, const PxVehicleDrivableSurfaceToTireFrictionPairs &vehicleDrivableSurfaceToTireFrictionPairs, const PxU32 nbVehicles, PxVehicleWheels **vehicles, PxVehicleWheelQueryResult *vehicleWheelQueryResults, PxVehicleConcurrentUpdateData *vehicleConcurrentUpdates=NULL, const PxVehicleContext &context=PxVehicleGetDefaultContext())
Update an array of vehicles by either applying an acceleration to the rigid body actor associated wit...
Definition PxVehicleUpdate.cpp:7084
@ eSTATIC
Traverse static shapes.
Definition PxQueryFiltering.h:58
@ ePREFILTER
Run the pre-intersection-test filter (see PxQueryFilterCallback::preFilter())
Definition PxQueryFiltering.h:62
@ eDYNAMIC
Traverse dynamic shapes.
Definition PxQueryFiltering.h:60
Structure containing data that is computed for a vehicle and its wheels during concurrent calls to Px...
Definition PxVehicleUpdate.h:272
PxVehicleWheelConcurrentUpdateData * concurrentWheelUpdates
Pointer to an PxVehicleWheelConcurrentUpdate buffer of length nbConcurrentWheelUpdates The concurrent...
Definition PxVehicleUpdate.h:291
PxU32 nbConcurrentWheelUpdates
The length of the concurrentWheelUpdates buffer. This value corresponds to the number of wheels in th...
Definition PxVehicleUpdate.h:297
Structure containing data that is computed for a wheel during concurrent calls to PxVehicleUpdates or...
Definition PxVehicleUpdate.h:245
Definition PxVehicleUpdate.h:220
PxWheelQueryResult * wheelQueryResults
Pointer to an PxWheelQueryResult buffer of length nbWheelQueryResults The wheelQueryResults buffer mu...
Definition PxVehicleUpdate.h:229
PxU32 nbWheelQueryResults
The length of the wheelQueryResults buffer. This value corresponds to the number of wheels in the ass...
Definition PxVehicleUpdate.h:235
Structure containing data describing the non-persistent state of each suspension/wheel/tire unit....
Definition PxVehicleUpdate.h:56
PxReal suspLineLength
Lengths of suspension line raycast/sweep used in raycast/sweep completed immediately before PxVehicle...
Definition PxVehicleUpdate.h:84
PxVec3 tireContactPoint
Point on the drivable surface hit by the most recent suspension raycast or sweep.
Definition PxVehicleUpdate.h:133
PxVec3 suspLineStart
Start point of suspension line raycast/sweep used in the raycast/sweep completed immediately before P...
Definition PxVehicleUpdate.h:70
PxReal longitudinalSlip
Longitudinal slip of the tire.
Definition PxVehicleUpdate.h:195
PxReal steerAngle
Steer angle of the wheel about the "up" vector accounting for input steer and toe and,...
Definition PxVehicleUpdate.h:211
PxU32 tireSurfaceType
Surface type integer that corresponds to the mapping between tireSurfaceMaterial and integer as descr...
Definition PxVehicleUpdate.h:126
PxVec3 tireContactNormal
Normal on the drivable surface at the hit point of the most recent suspension raycast or sweep.
Definition PxVehicleUpdate.h:140
PxReal lateralSlip
Lateral slip of the tire.
Definition PxVehicleUpdate.h:205
PxTransform localPose
Local pose of the wheel.
Definition PxVehicleUpdate.h:216
const PxMaterial * tireSurfaceMaterial
PxMaterial instance of the driving surface under the corresponding vehicle wheel.
Definition PxVehicleUpdate.h:115
PxVec3 tireLateralDir
Lateral direction of the wheel/tire accounting for steer/toe/camber angle projected on to the contact...
Definition PxVehicleUpdate.h:185
PxShape * tireContactShape
PxShape instance of the driving surface under the corresponding vehicle wheel.
Definition PxVehicleUpdate.h:108
PxVec3 tireLongitudinalDir
Forward direction of the wheel/tire accounting for steer/toe/camber angle projected on to the contact...
Definition PxVehicleUpdate.h:177
bool isInAir
If suspension travel limits forbid the wheel from touching the drivable surface then isInAir is true.
Definition PxVehicleUpdate.h:94
PxReal tireFriction
Friction experienced by the tire for the combination of tire type and surface type after accounting f...
Definition PxVehicleUpdate.h:150
PxActor * tireContactActor
PxActor instance of the driving surface under the corresponding vehicle wheel.
Definition PxVehicleUpdate.h:101
PxReal suspSpringForce
Magnitude of force applied by the suspension spring along the direction of suspension travel.
Definition PxVehicleUpdate.h:169
PxReal suspJounce
Compression of the suspension spring.
Definition PxVehicleUpdate.h:160
PxVec3 suspLineDir
Directions of suspension line raycast/sweep used in the raycast/sweep completed immediately before Px...
Definition PxVehicleUpdate.h:77