PxVehicleDrive4W.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_4WDRIVE_H
31 #define PX_VEHICLE_4WDRIVE_H
32 
36 #include "vehicle/PxVehicleDrive.h"
39 
40 
41 #if !PX_DOXYGEN
42 namespace physx
43 {
44 #endif
45 
46 struct PxFilterData;
47 class PxGeometry;
48 class PxPhysics;
50 class PxShape;
51 class PxMaterial;
52 class PxRigidDynamic;
53 
60 {
61 //= ATTENTION! =====================================================================================
62 // Changing the data layout of this class breaks the binary serialization format. See comments for
63 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
64 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
65 // accordingly.
66 //==================================================================================================
67 public:
68 
69  friend class PxVehicleDrive4W;
70 
73  {
74  }
75 
81  {
82  return mDiff;
83  }
84 
90  {
91  return mAckermannGeometry;
92  }
93 
98  void setDiffData(const PxVehicleDifferential4WData& diff);
99 
104  void setAckermannGeometryData(const PxVehicleAckermannGeometryData& ackermannData);
105 
106 private:
107 
113 
119 
125  bool isValid() const;
126 
127 //serialization
128 public:
130  static void getBinaryMetaData(PxOutputStream& stream);
131 //~serialization
132 };
134 
135 
136 
144 {
145  enum Enum
146  {
147  eFRONT_LEFT=0,
150  eREAR_RIGHT
151  };
152 };
153 
161 {
162  enum Enum
163  {
164  eANALOG_INPUT_ACCEL=0,
169  eMAX_NB_DRIVE4W_ANALOG_INPUTS
170  };
171 };
172 
177 {
178 //= ATTENTION! =====================================================================================
179 // Changing the data layout of this class breaks the binary serialization format. See comments for
180 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
181 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
182 // accordingly.
183 //==================================================================================================
184 public:
185  friend class PxVehicleUpdate;
186 
196  static PxVehicleDrive4W* allocate(const PxU32 nbWheels);
197 
202  void free();
203 
215  void setup
216  (PxPhysics* physics, PxRigidDynamic* vehActor,
217  const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData,
218  const PxU32 nbNonDrivenWheels);
219 
232  static PxVehicleDrive4W* create
233  (PxPhysics* physics, PxRigidDynamic* vehActor,
234  const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData,
235  const PxU32 nbNonDrivenWheels);
236 
244  void setToRestState();
245 
251 
252 private:
253 
257  bool isValid() const;
258 
259 //serialization
260 protected:
263  virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDrive4W", name) || PxBase::isKindOf(name); }
264 public:
265  static PxVehicleDrive4W* createObject(PxU8*& address, PxDeserializationContext& context);
266  static void getBinaryMetaData(PxOutputStream& stream);
267  PxVehicleDrive4W(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags), mDriveSimData(PxEmpty) {}
268  virtual const char* getConcreteTypeName() const { return "PxVehicleDrive4W"; }
269 //~serialization
270 };
271 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDrive4W) & 15));
272 
273 #if !PX_DOXYGEN
274 } // namespace physx
275 #endif
276 
278 #endif //PX_VEHICLE_4WDRIVE_H
Definition: GuContactBuffer.h:37
Friction for each combination of driving surface type and tire type.
Definition: PxVehicleTireFriction.h:62
Definition: PxVehicleDrive4W.h:166
bool isValid() const
Test if the instanced dynamics and configuration data has legal values.
Definition: PxVehicleComponents.h:430
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxVehicleDrive4W.h:263
PX_FORCE_INLINE const PxVehicleAckermannGeometryData & getAckermannGeometryData() const
Return the data describing the Ackermann steer-correction.
Definition: PxVehicleDrive4W.h:89
PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK.
Definition: PxRigidDynamic.h:83
PxFilterData is user-definable data which gets passed into the collision filtering shader and/or call...
Definition: PxFiltering.h:366
PxVehicleDrive4W(PxBaseFlags baseFlags)
Definition: PxVehicleDrive4W.h:267
Definition: PxVehicleDrive4W.h:149
PxVehicleDifferential4WData mDiff
Differential simulation data.
Definition: PxVehicleDrive4W.h:112
Abstract class for collision shapes.
Definition: PxShape.h:142
#define PX_FORCE_INLINE
Definition: PxPreprocessor.h:351
virtual bool isKindOf(const char *superClass) const
Returns whether a given type name matches with the type of this instance.
Definition: PxBase.h:178
Enum
Definition: PxVehicleDrive4W.h:162
Definition: PxVehicleDrive4W.h:148
A geometry object.
Definition: PxGeometry.h:75
Output stream class for I/O.
Definition: PxIO.h:114
Data structure describing non-wheel configuration data of a vehicle that has engine, gears, clutch, and auto-box.
Definition: PxVehicleDrive.h:56
Definition: PxVehicleDrive4W.h:167
Data structure describing configuration data of a vehicle with up to 20 wheels.
Definition: PxVehicleWheels.h:123
A complete vehicle with instance dynamics data and configuration data for wheels and engine...
Definition: PxVehicleDrive.h:496
uint8_t PxU8
Definition: PxSimpleTypes.h:75
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition: PxVehicleDrive4W.h:268
~PxVehicleDrive4W()
Definition: PxVehicleDrive4W.h:262
Definition: PxVehicleDrive4W.h:165
#define PX_COMPILE_TIME_ASSERT(exp)
Definition: PxPreprocessor.h:434
Enum
Definition: PxVehicleDrive4W.h:145
PxVehicleDriveSimData4W()
Definition: PxVehicleDrive4W.h:71
The ordering of the driven and steered wheels of a PxVehicleDrive4W.
Definition: PxVehicleDrive4W.h:143
Data structure with instanced dynamics data and configuration data of a vehicle with up to 4 driven w...
Definition: PxVehicleDrive4W.h:176
PxEMPTY
Definition: Px.h:70
Binary deserialization context class.
Definition: PxSerialFramework.h:174
Material class to represent a set of surface properties.
Definition: PxMaterial.h:143
PxVehicleDriveSimData4W mDriveSimData
Simulation data that describes the configuration of the vehicle's drive model.
Definition: PxVehicleDrive4W.h:250
The control inputs for a PxVehicleDrive4W.
Definition: PxVehicleDrive4W.h:160
Abstract singleton factory class used for instancing objects in the Physics SDK.
Definition: PxPhysics.h:71
PxVehicleAckermannGeometryData mAckermannGeometry
Data for ackermann steer angle computation.
Definition: PxVehicleDrive4W.h:118
uint32_t PxU32
Definition: Px.h:48
Definition: PxVehicleDrive4W.h:168
PxVehicleDriveSimData4W(const PxEMPTY)
Definition: PxVehicleDrive4W.h:129
Definition: PxVehicleComponents.h:582
static void getBinaryMetaData(PxOutputStream &stream)
Data structure describing the drive model components of a vehicle with up to 4 driven wheels and up t...
Definition: PxVehicleDrive4W.h:59
PX_FORCE_INLINE const PxVehicleDifferential4WData & getDiffData() const
Return the data describing the differential.
Definition: PxVehicleDrive4W.h:80
Definition: Px.h:72