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