PxVehicleDriveTank.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_DRIVE_TANK_H
31 #define PX_VEHICLE_DRIVE_TANK_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  enum Enum
62  {
63  eFRONT_LEFT=0,
82  e9TH_FROM_FRONT_RIGHT
83  };
84 };
85 
86 
106 {
107  enum Enum
108  {
109  eANALOG_INPUT_ACCEL=0,
114  eMAX_NB_DRIVETANK_ANALOG_INPUTS
115  };
116 };
117 
138 {
139  enum Enum
140  {
141  eSTANDARD=0,
142  eSPECIAL
143  };
144 };
145 
146 
151 {
152 //= ATTENTION! =====================================================================================
153 // Changing the data layout of this class breaks the binary serialization format. See comments for
154 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
155 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
156 // accordingly.
157 //==================================================================================================
158 public:
159 
160  friend class PxVehicleUpdate;
161 
162 
174  static PxVehicleDriveTank* allocate(const PxU32 nbWheels);
175 
180  void free();
181 
195  void setup
196  (PxPhysics* physics, PxRigidDynamic* vehActor,
197  const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData& driveData,
198  const PxU32 nbDrivenWheels);
199 
211  static PxVehicleDriveTank* create
212  (PxPhysics* physics, PxRigidDynamic* vehActor,
213  const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData& driveData,
214  const PxU32 nbDrivenWheels);
215 
223  {
224  mDriveModel=driveModel;
225  }
226 
231 
239  void setToRestState();
240 
246 
247 private:
251  bool isValid() const;
252 
258 
259  PxU32 mPad[3];
260 
261 //serialization
262 public:
263  PxVehicleDriveTank(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags) {}
264  static PxVehicleDriveTank* createObject(PxU8*& address, PxDeserializationContext& context);
265  static void getBinaryMetaData(PxOutputStream& stream);
266  virtual const char* getConcreteTypeName() const { return "PxVehicleDriveTank"; }
267  virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDriveTank", name) || PxBase::isKindOf(name); }
268 protected:
271 //~serialization
272 };
273 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveTank) & 15));
274 
275 #if !PX_DOXYGEN
276 } // namespace physx
277 #endif
278 
280 #endif //PX_VEHICLE_DRIVE_TANK_H
Definition: GuContactBuffer.h:37
Friction for each combination of driving surface type and tire type.
Definition: PxVehicleTireFriction.h:62
Definition: PxVehicleDriveTank.h:67
Enum
Definition: PxVehicleDriveTank.h:61
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
Definition: PxVehicleDriveTank.h:73
Definition: PxVehicleDriveTank.h:65
Abstract class for collision shapes.
Definition: PxShape.h:142
virtual bool isKindOf(const char *superClass) const
Returns whether a given type name matches with the type of this instance.
Definition: PxBase.h:178
PxVehicleDriveTankControlModel::Enum mDriveModel
Drive model.
Definition: PxVehicleDriveTank.h:257
Two driving models are supported.
Definition: PxVehicleDriveTank.h:137
Definition: PxVehicleDriveTank.h:74
A geometry object.
Definition: PxGeometry.h:75
Definition: PxVehicleDriveTank.h:110
Enum
Definition: PxVehicleDriveTank.h:139
Definition: PxVehicleDriveTank.h:77
PxVehicleDriveSimData mDriveSimData
Simulation data that models vehicle components.
Definition: PxVehicleDriveTank.h:245
Output stream class for I/O.
Definition: PxIO.h:114
Definition: PxVehicleDriveTank.h:81
Data structure describing non-wheel configuration data of a vehicle that has engine, gears, clutch, and auto-box.
Definition: PxVehicleDrive.h:56
Definition: PxVehicleDriveTank.h:112
Data structure describing configuration data of a vehicle with up to 20 wheels.
Definition: PxVehicleWheels.h:123
PxVehicleDriveTankControlModel::Enum getDriveModel() const
Return the control model used by the tank.
Definition: PxVehicleDriveTank.h:230
A complete vehicle with instance dynamics data and configuration data for wheels and engine...
Definition: PxVehicleDrive.h:496
Definition: PxVehicleDriveTank.h:75
Definition: PxVehicleDriveTank.h:64
The ordering of the wheels of a PxVehicleDriveTank.
Definition: PxVehicleDriveTank.h:59
Definition: PxVehicleDriveTank.h:70
The control inputs for a PxVehicleDriveTank.
Definition: PxVehicleDriveTank.h:105
Definition: PxVehicleDriveTank.h:68
uint8_t PxU8
Definition: PxSimpleTypes.h:75
Definition: PxVehicleDriveTank.h:71
Definition: PxVehicleDriveTank.h:72
Definition: PxVehicleDriveTank.h:78
#define PX_COMPILE_TIME_ASSERT(exp)
Definition: PxPreprocessor.h:434
Enum
Definition: PxVehicleDriveTank.h:107
Definition: PxVehicleDriveTank.h:66
Definition: PxVehicleDriveTank.h:76
Definition: PxVehicleDriveTank.h:69
Definition: PxVehicleDriveTank.h:113
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition: PxVehicleDriveTank.h:266
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxVehicleDriveTank.h:267
Binary deserialization context class.
Definition: PxSerialFramework.h:174
Material class to represent a set of surface properties.
Definition: PxMaterial.h:143
PxVehicleDriveTank(PxBaseFlags baseFlags)
Definition: PxVehicleDriveTank.h:263
Abstract singleton factory class used for instancing objects in the Physics SDK.
Definition: PxPhysics.h:71
~PxVehicleDriveTank()
Definition: PxVehicleDriveTank.h:270
uint32_t PxU32
Definition: Px.h:48
Data structure with instanced dynamics data and configuration data of a tank.
Definition: PxVehicleDriveTank.h:150
void setDriveModel(const PxVehicleDriveTankControlModel::Enum driveModel)
Set the control model used by the tank.
Definition: PxVehicleDriveTank.h:222
Definition: PxVehicleDriveTank.h:111
Definition: PxVehicleDriveTank.h:80
Definition: PxVehicleDriveTank.h:79