PxVehicleNoDrive.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12 
13 #ifndef PX_VEHICLE_NO_DRIVE_H
14 #define PX_VEHICLE_NO_DRIVE_H
15 
21 
22 
23 #ifndef PX_DOXYGEN
24 namespace physx
25 {
26 #endif
27 
28 struct PxFilterData;
29 class PxGeometry;
30 class PxPhysics;
31 class PxBatchQuery;
33 class PxShape;
34 class PxMaterial;
35 class PxRigidDynamic;
36 
41 {
42 //= ATTENTION! =====================================================================================
43 // Changing the data layout of this class breaks the binary serialization format. See comments for
44 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
45 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
46 // accordingly.
47 //==================================================================================================
48 public:
49 
50  friend class PxVehicleUpdate;
51 
61  static PxVehicleNoDrive* allocate(const PxU32 nbWheels);
62 
67  void free();
68 
77  void setup
78  (PxPhysics* physics, PxRigidDynamic* vehActor, const PxVehicleWheelsSimData& wheelsData);
79 
89  static PxVehicleNoDrive* create
90  (PxPhysics* physics, PxRigidDynamic* vehActor, const PxVehicleWheelsSimData& wheelsData);
91 
99  void setToRestState();
100 
111  void setBrakeTorque(const PxU32 id, const PxReal brakeTorque);
112 
123  void setDriveTorque(const PxU32 id, const PxReal driveTorque);
124 
135  void setSteerAngle(const PxU32 id, const PxReal steerAngle);
136 
142  PxReal getBrakeTorque(const PxU32 id) const;
143 
149  PxReal getDriveTorque(const PxU32 id) const;
150 
156  PxReal getSteerAngle(const PxU32 id) const;
157 
158 private:
159 
163 
164 #if defined(PX_P64)
165  PxU32 mPad[2];
166 #else
167  PxU32 mPad[1];
168 #endif
169 
173  bool isValid() const;
174 
175 
176 //serialization
177 public:
178  PxVehicleNoDrive(PxBaseFlags baseFlags) : PxVehicleWheels(baseFlags) {}
179  virtual void exportExtraData(PxSerializationContext&);
180  void importExtraData(PxDeserializationContext&);
181  static PxVehicleNoDrive* createObject(PxU8*& address, PxDeserializationContext& context);
182  static void getBinaryMetaData(PxOutputStream& stream);
183  virtual const char* getConcreteTypeName() const { return "PxVehicleNoDrive"; }
184  virtual bool isKindOf(const char* name) const { return !strcmp("PxVehicleNoDrive", name) || PxBase::isKindOf(name); }
185  PxU32 getNbSteerAngle() const { return mWheelsSimData.getNbWheels(); }
186  PxU32 getNbDriveTorque() const { return mWheelsSimData.getNbWheels(); }
187  PxU32 getNbBrakeTorque() const { return mWheelsSimData.getNbWheels(); }
188 protected:
191 //~serialization
192 };
193 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleNoDrive) & 15));
194 
195 #ifndef PX_DOXYGEN
196 } // namespace physx
197 #endif
198 
200 #endif //PX_VEHICLE_NO_DRIVE_H


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com