RavEngine
Loading...
Searching...
No Matches
PxVehicleDrive4W.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_4WDRIVE_H
30#define PX_VEHICLE_4WDRIVE_H
31
32#include "vehicle/PxVehicleDrive.h"
33#include "vehicle/PxVehicleWheels.h"
34#include "vehicle/PxVehicleComponents.h"
35
36
37#if !PX_DOXYGEN
38namespace physx
39{
40#endif
41
42struct PxFilterData;
43class PxGeometry;
44class PxPhysics;
45class PxVehicleDrivableSurfaceToTireFrictionPairs;
46class PxShape;
47class PxMaterial;
48class PxRigidDynamic;
49
56{
57//= ATTENTION! =====================================================================================
58// Changing the data layout of this class breaks the binary serialization format. See comments for
59// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
60// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
61// accordingly.
62//==================================================================================================
63public:
64
65 friend class PxVehicleDrive4W;
66
69 {
70 }
71
77 {
78 return mDiff;
79 }
80
86 {
87 return mAckermannGeometry;
88 }
89
94 void setDiffData(const PxVehicleDifferential4WData& diff);
95
100 void setAckermannGeometryData(const PxVehicleAckermannGeometryData& ackermannData);
101
102private:
103
109
114 PxVehicleAckermannGeometryData mAckermannGeometry;
115
121 bool isValid() const;
122
123//serialization
124public:
125 PxVehicleDriveSimData4W(const PxEMPTY) : PxVehicleDriveSimData(PxEmpty), mDiff(PxEmpty), mAckermannGeometry(PxEmpty) {}
126 static void getBinaryMetaData(PxOutputStream& stream);
127//~serialization
128};
129PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveSimData4W) & 15));
130
131
132
140{
141 enum Enum
142 {
143 eFRONT_LEFT=0,
144 eFRONT_RIGHT,
145 eREAR_LEFT,
146 eREAR_RIGHT
147 };
148};
149
157{
158 enum Enum
159 {
160 eANALOG_INPUT_ACCEL=0,
161 eANALOG_INPUT_BRAKE,
162 eANALOG_INPUT_HANDBRAKE,
163 eANALOG_INPUT_STEER_LEFT,
164 eANALOG_INPUT_STEER_RIGHT,
165 eMAX_NB_DRIVE4W_ANALOG_INPUTS
166 };
167};
168
173{
174//= ATTENTION! =====================================================================================
175// Changing the data layout of this class breaks the binary serialization format. See comments for
176// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
177// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
178// accordingly.
179//==================================================================================================
180public:
181 friend class PxVehicleUpdate;
182
192 static PxVehicleDrive4W* allocate(const PxU32 nbWheels);
193
198 void free();
199
211 void setup
212 (PxPhysics* physics, PxRigidDynamic* vehActor,
213 const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData,
214 const PxU32 nbNonDrivenWheels);
215
228 static PxVehicleDrive4W* create
229 (PxPhysics* physics, PxRigidDynamic* vehActor,
230 const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData,
231 const PxU32 nbNonDrivenWheels);
232
240 void setToRestState();
241
247
248private:
249
253 bool isValid() const;
254
255//serialization
256protected:
259 virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDrive4W", name) || PxBase::isKindOf(name); }
260public:
261 static PxVehicleDrive4W* createObject(PxU8*& address, PxDeserializationContext& context);
262 static void getBinaryMetaData(PxOutputStream& stream);
263 PxVehicleDrive4W(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags), mDriveSimData(PxEmpty) {}
264 virtual const char* getConcreteTypeName() const { return "PxVehicleDrive4W"; }
265//~serialization
266};
267PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDrive4W) & 15));
268
269#if !PX_DOXYGEN
270} // namespace physx
271#endif
272
273#endif
Definition base.h:1940
Binary deserialization context class.
Definition PxSerialFramework.h:174
Output stream class for I/O.
Definition PxIO.h:114
Abstract singleton factory class used for instancing objects in the Physics SDK.
Definition PxPhysics.h:91
PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK.
Definition PxRigidDynamic.h:82
Definition PxVehicleComponents.h:579
Definition PxVehicleComponents.h:427
Data structure with instanced dynamics data and configuration data of a vehicle with up to 4 driven w...
Definition PxVehicleDrive4W.h:173
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxVehicleDrive4W.h:259
PxVehicleDriveSimData4W mDriveSimData
Simulation data that describes the configuration of the vehicle's drive model.
Definition PxVehicleDrive4W.h:246
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition PxVehicleDrive4W.h:264
Data structure describing the drive model components of a vehicle with up to 4 driven wheels and up t...
Definition PxVehicleDrive4W.h:56
PX_FORCE_INLINE const PxVehicleDifferential4WData & getDiffData() const
Return the data describing the differential.
Definition PxVehicleDrive4W.h:76
PX_FORCE_INLINE const PxVehicleAckermannGeometryData & getAckermannGeometryData() const
Return the data describing the Ackermann steer-correction.
Definition PxVehicleDrive4W.h:85
Data structure describing non-wheel configuration data of a vehicle that has engine,...
Definition PxVehicleDrive.h:53
A complete vehicle with instance dynamics data and configuration data for wheels and engine,...
Definition PxVehicleDrive.h:493
Definition PxVehicleUpdate.cpp:4519
Data structure describing configuration data of a vehicle with up to 20 wheels.
Definition PxVehicleWheels.h:129
#define PX_FORCE_INLINE
Definition PxPreprocessor.h:335
#define PX_COMPILE_TIME_ASSERT(exp)
Definition PxPreprocessor.h:428
#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
PxEMPTY
Definition Px.h:87
The control inputs for a PxVehicleDrive4W.
Definition PxVehicleDrive4W.h:157
The ordering of the driven and steered wheels of a PxVehicleDrive4W.
Definition PxVehicleDrive4W.h:140