RavEngine
Loading...
Searching...
No Matches
PxVehicleDriveTank.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_DRIVE_TANK_H
30#define PX_VEHICLE_DRIVE_TANK_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 enum Enum
58 {
59 eFRONT_LEFT=0,
60 eFRONT_RIGHT,
61 e1ST_FROM_FRONT_LEFT,
62 e1ST_FROM_FRONT_RIGHT,
63 e2ND_FROM_FRONT_LEFT,
64 e2ND_FROM_FRONT_RIGHT,
65 e3RD_FROM_FRONT_LEFT,
66 e3RD_FROM_FRONT_RIGHT,
67 e4TH_FROM_FRONT_LEFT,
68 e4TH_FROM_FRONT_RIGHT,
69 e5TH_FROM_FRONT_LEFT,
70 e5TH_FROM_FRONT_RIGHT,
71 e6TH_FROM_FRONT_LEFT,
72 e6TH_FROM_FRONT_RIGHT,
73 e7TH_FROM_FRONT_LEFT,
74 e7TH_FROM_FRONT_RIGHT,
75 e8TH_FROM_FRONT_LEFT,
76 e8TH_FROM_FRONT_RIGHT,
77 e9TH_FROM_FRONT_LEFT,
78 e9TH_FROM_FRONT_RIGHT
79 };
80};
81
82
102{
103 enum Enum
104 {
105 eANALOG_INPUT_ACCEL=0,
106 eANALOG_INPUT_BRAKE_LEFT,
107 eANALOG_INPUT_BRAKE_RIGHT,
108 eANALOG_INPUT_THRUST_LEFT,
109 eANALOG_INPUT_THRUST_RIGHT,
110 eMAX_NB_DRIVETANK_ANALOG_INPUTS
111 };
112};
113
134{
135 enum Enum
136 {
137 eSTANDARD=0,
138 eSPECIAL
139 };
140};
141
142
147{
148//= ATTENTION! =====================================================================================
149// Changing the data layout of this class breaks the binary serialization format. See comments for
150// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
151// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
152// accordingly.
153//==================================================================================================
154public:
155
156 friend class PxVehicleUpdate;
157
158
170 static PxVehicleDriveTank* allocate(const PxU32 nbWheels);
171
176 void free();
177
191 void setup
192 (PxPhysics* physics, PxRigidDynamic* vehActor,
193 const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData& driveData,
194 const PxU32 nbDrivenWheels);
195
207 static PxVehicleDriveTank* create
208 (PxPhysics* physics, PxRigidDynamic* vehActor,
209 const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimData& driveData,
210 const PxU32 nbDrivenWheels);
211
218 void setDriveModel(const PxVehicleDriveTankControlModel::Enum driveModel)
219 {
220 mDriveModel=driveModel;
221 }
222
226 PxVehicleDriveTankControlModel::Enum getDriveModel() const {return mDriveModel;}
227
235 void setToRestState();
236
242
243private:
247 bool isValid() const;
248
253 PxVehicleDriveTankControlModel::Enum mDriveModel;
254
255 PxU32 mPad[3];
256
257//serialization
258public:
259 PxVehicleDriveTank(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags) {}
260 static PxVehicleDriveTank* createObject(PxU8*& address, PxDeserializationContext& context);
261 static void getBinaryMetaData(PxOutputStream& stream);
262 virtual const char* getConcreteTypeName() const { return "PxVehicleDriveTank"; }
263 virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDriveTank", name) || PxBase::isKindOf(name); }
264protected:
267//~serialization
268};
269PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveTank) & 15));
270
271#if !PX_DOXYGEN
272} // namespace physx
273#endif
274
275#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
Data structure describing non-wheel configuration data of a vehicle that has engine,...
Definition PxVehicleDrive.h:53
Data structure with instanced dynamics data and configuration data of a tank.
Definition PxVehicleDriveTank.h:147
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxVehicleDriveTank.h:263
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition PxVehicleDriveTank.h:262
void setDriveModel(const PxVehicleDriveTankControlModel::Enum driveModel)
Set the control model used by the tank.
Definition PxVehicleDriveTank.h:218
PxVehicleDriveTankControlModel::Enum getDriveModel() const
Return the control model used by the tank.
Definition PxVehicleDriveTank.h:226
PxVehicleDriveSimData mDriveSimData
Simulation data that models vehicle components.
Definition PxVehicleDriveTank.h:241
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_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
Two driving models are supported.
Definition PxVehicleDriveTank.h:134
The control inputs for a PxVehicleDriveTank.
Definition PxVehicleDriveTank.h:102
The ordering of the wheels of a PxVehicleDriveTank.
Definition PxVehicleDriveTank.h:56