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-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_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;
49 class PxBatchQuery;
51 class PxShape;
52 class PxMaterial;
53 class PxRigidDynamic;
54 
61 {
62 //= ATTENTION! =====================================================================================
63 // Changing the data layout of this class breaks the binary serialization format. See comments for
64 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
65 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
66 // accordingly.
67 //==================================================================================================
68 public:
69 
70  friend class PxVehicleDrive4W;
71 
74  {
75  }
76 
82  {
83  return mDiff;
84  }
85 
91  {
92  return mAckermannGeometry;
93  }
94 
99  void setDiffData(const PxVehicleDifferential4WData& diff);
100 
105  void setAckermannGeometryData(const PxVehicleAckermannGeometryData& ackermannData);
106 
107 private:
108 
114 
120 
126  bool isValid() const;
127 
128 //serialization
129 public:
131  static void getBinaryMetaData(PxOutputStream& stream);
132 //~serialization
133 };
135 
136 
137 
145 {
146  enum Enum
147  {
148  eFRONT_LEFT=0,
151  eREAR_RIGHT
152  };
153 };
154 
162 {
163  enum Enum
164  {
165  eANALOG_INPUT_ACCEL=0,
170  eMAX_NB_DRIVE4W_ANALOG_INPUTS
171  };
172 };
173 
178 {
179 //= ATTENTION! =====================================================================================
180 // Changing the data layout of this class breaks the binary serialization format. See comments for
181 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
182 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
183 // accordingly.
184 //==================================================================================================
185 public:
186  friend class PxVehicleUpdate;
187 
197  static PxVehicleDrive4W* allocate(const PxU32 nbWheels);
198 
203  void free();
204 
216  void setup
217  (PxPhysics* physics, PxRigidDynamic* vehActor,
218  const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData,
219  const PxU32 nbNonDrivenWheels);
220 
233  static PxVehicleDrive4W* create
234  (PxPhysics* physics, PxRigidDynamic* vehActor,
235  const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData4W& driveData,
236  const PxU32 nbNonDrivenWheels);
237 
245  void setToRestState();
246 
252 
253 private:
254 
258  bool isValid() const;
259 
260 //serialization
261 protected:
264  virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDrive4W", name) || PxBase::isKindOf(name); }
265 public:
266  static PxVehicleDrive4W* createObject(PxU8*& address, PxDeserializationContext& context);
267  static void getBinaryMetaData(PxOutputStream& stream);
268  PxVehicleDrive4W(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags), mDriveSimData(PxEmpty) {}
269  virtual const char* getConcreteTypeName() const { return "PxVehicleDrive4W"; }
270 //~serialization
271 };
272 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDrive4W) & 15));
273 
274 #if !PX_DOXYGEN
275 } // namespace physx
276 #endif
277 
279 #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:167
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:264
PX_FORCE_INLINE const PxVehicleAckermannGeometryData & getAckermannGeometryData() const
Return the data describing the Ackermann steer-correction.
Definition: PxVehicleDrive4W.h:90
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:268
Definition: PxVehicleDrive4W.h:150
PxVehicleDifferential4WData mDiff
Differential simulation data.
Definition: PxVehicleDrive4W.h:113
Abstract class for collision shapes.
Definition: PxShape.h:142
#define PX_FORCE_INLINE
Definition: PxPreprocessor.h:364
Batched queries object. This is used to perform several queries at the same time. ...
Definition: PxBatchQuery.h:57
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:163
Definition: PxVehicleDrive4W.h:149
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:57
Definition: PxVehicleDrive4W.h:168
Data structure describing configuration data of a vehicle with up to 20 wheels.
Definition: PxVehicleWheels.h:59
A complete vehicle with instance dynamics data and configuration data for wheels and engine...
Definition: PxVehicleDrive.h:497
uint8_t PxU8
Definition: PxSimpleTypes.h:75
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition: PxVehicleDrive4W.h:269
~PxVehicleDrive4W()
Definition: PxVehicleDrive4W.h:263
Definition: PxVehicleDrive4W.h:166
#define PX_COMPILE_TIME_ASSERT(exp)
Definition: PxPreprocessor.h:447
Enum
Definition: PxVehicleDrive4W.h:146
PxVehicleDriveSimData4W()
Definition: PxVehicleDrive4W.h:72
The ordering of the driven and steered wheels of a PxVehicleDrive4W.
Definition: PxVehicleDrive4W.h:144
Data structure with instanced dynamics data and configuration data of a vehicle with up to 4 driven w...
Definition: PxVehicleDrive4W.h:177
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:130
PxVehicleDriveSimData4W mDriveSimData
Simulation data that describes the configuration of the vehicle's drive model.
Definition: PxVehicleDrive4W.h:251
The control inputs for a PxVehicleDrive4W.
Definition: PxVehicleDrive4W.h:161
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:119
uint32_t PxU32
Definition: Px.h:48
Definition: PxVehicleDrive4W.h:169
PxVehicleDriveSimData4W(const PxEMPTY)
Definition: PxVehicleDrive4W.h:130
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:60
PX_FORCE_INLINE const PxVehicleDifferential4WData & getDiffData() const
Return the data describing the differential.
Definition: PxVehicleDrive4W.h:81
Definition: Px.h:72