RavEngine
Loading...
Searching...
No Matches
PxVehicleDriveNW.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_NWDRIVE_H
30#define PX_VEHICLE_NWDRIVE_H
31
32#include "vehicle/PxVehicleDrive.h"
33#include "vehicle/PxVehicleWheels.h"
34#include "vehicle/PxVehicleComponents.h"
35
36#if !PX_DOXYGEN
37namespace physx
38{
39#endif
40
41struct PxFilterData;
42class PxGeometry;
43class PxPhysics;
44class PxVehicleDrivableSurfaceToTireFrictionPairs;
45class PxShape;
46class PxMaterial;
47class PxRigidDynamic;
48
55{
56//= ATTENTION! =====================================================================================
57// Changing the data layout of this class breaks the binary serialization format. See comments for
58// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
59// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
60// accordingly.
61//==================================================================================================
62public:
63
64 friend class PxVehicleDriveNW;
65
68 {
69 }
70
75 {
76 return mDiff;
77 }
78
83 void setDiffData(const PxVehicleDifferentialNWData& diff);
84
85private:
86
92
98 bool isValid() const;
99
100//serialization
101public:
102 PxVehicleDriveSimDataNW(const PxEMPTY) : PxVehicleDriveSimData(PxEmpty), mDiff(PxEmpty) {}
103 static void getBinaryMetaData(PxOutputStream& stream);
104//~serialization
105};
106PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveSimDataNW) & 15));
107
108
115{
116 enum Enum
117 {
118 eANALOG_INPUT_ACCEL=0,
119 eANALOG_INPUT_BRAKE,
120 eANALOG_INPUT_HANDBRAKE,
121 eANALOG_INPUT_STEER_LEFT,
122 eANALOG_INPUT_STEER_RIGHT,
123 eMAX_NB_DRIVENW_ANALOG_INPUTS
124 };
125};
126
131{
132//= ATTENTION! =====================================================================================
133// Changing the data layout of this class breaks the binary serialization format. See comments for
134// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
135// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
136// accordingly.
137//==================================================================================================
138public:
139
140 friend class PxVehicleUpdate;
141
151 static PxVehicleDriveNW* allocate(const PxU32 nbWheels);
152
157 void free();
158
169 void setup
170 (PxPhysics* physics, PxRigidDynamic* vehActor,
171 const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimDataNW& driveData,
172 const PxU32 nbWheels);
173
185 static PxVehicleDriveNW* create
186 (PxPhysics* physics, PxRigidDynamic* vehActor,
187 const PxVehicleWheelsSimData& wheelsData, const PxVehicleDriveSimDataNW& driveData,
188 const PxU32 nbWheels);
189
197 void setToRestState();
198
204
205private:
206
210 bool isValid() const;
211
212//serialization
213public:
214 PxVehicleDriveNW(PxBaseFlags baseFlags) : PxVehicleDrive(baseFlags), mDriveSimData(PxEmpty) {}
217 static PxVehicleDriveNW* createObject(PxU8*& address, PxDeserializationContext& context);
218 static void getBinaryMetaData(PxOutputStream& stream);
219 virtual const char* getConcreteTypeName() const { return "PxVehicleDriveNW"; }
220 virtual bool isKindOf(const char* name) const { return !::strcmp("PxVehicleDriveNW", name) || PxBase::isKindOf(name); }
221//~serialization
222};
223PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDriveNW) & 15));
224
225
226
227#if !PX_DOXYGEN
228} // namespace physx
229#endif
230
231#endif
Definition base.h:1940
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
Definition PxVehicleComponents.h:532
Data structure with instanced dynamics data and configuration data of a vehicle with up to PX_MAX_NB_...
Definition PxVehicleDriveNW.h:131
PxVehicleDriveSimDataNW mDriveSimData
Simulation data that describes the configuration of the vehicle's drive model.
Definition PxVehicleDriveNW.h:203
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxVehicleDriveNW.h:220
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition PxVehicleDriveNW.h:219
Data structure describing configuration data of a vehicle with up to PX_MAX_NB_WHEELS driven equally ...
Definition PxVehicleDriveNW.h:55
const PxVehicleDifferentialNWData & getDiffData() const
Return the data describing the differential of a vehicle with up to PX_MAX_NB_WHEELS driven wheels.
Definition PxVehicleDriveNW.h:74
Data structure describing non-wheel configuration data of a vehicle that has engine,...
Definition PxVehicleDrive.h:53
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
PxEMPTY
Definition Px.h:87
The control inputs for a PxVehicleDriveNW.
Definition PxVehicleDriveNW.h:115