PxVehicleDriveTank Class Reference

Data structure with instanced dynamics data and configuration data of a tank. More...

#include <PxVehicleDriveTank.h>

Inheritance diagram for PxVehicleDriveTank:
Collaboration diagram for PxVehicleDriveTank:

Public Member Functions

void free ()
 Deallocate a PxVehicleDriveTank instance. More...
 
void setup (PxPhysics *physics, PxRigidDynamic *vehActor, const PxVehicleWheelsSimData &wheelsData, const PxVehicleDriveSimData &driveData, const PxU32 nbDrivenWheels)
 Set up a tank using simulation data for the wheels and drive model. More...
 
void setDriveModel (const PxVehicleDriveTankControlModel::Enum driveModel)
 Set the control model used by the tank. More...
 
PxVehicleDriveTankControlModel::Enum getDriveModel () const
 Return the control model used by the tank. More...
 
void setToRestState ()
 Set a vehicle to its rest state. Aside from the rigid body transform, this will set the vehicle and rigid body to the state they were in immediately after setup or create. More...
 
 PxVehicleDriveTank (PxBaseFlags baseFlags)
 
virtual const char * getConcreteTypeName () const
 Returns string name of dynamic type. More...
 
virtual bool isKindOf (const char *name) const
 Returns whether a given type name matches with the type of this instance. More...
 
- Public Member Functions inherited from PxVehicleDrive
 PxVehicleDrive (PxBaseFlags baseFlags)
 
- Public Member Functions inherited from PxVehicleWheels
PX_FORCE_INLINE PxU32 getVehicleType () const
 Return the type of vehicle. More...
 
PX_FORCE_INLINE PxRigidDynamicgetRigidDynamicActor ()
 Get non-const ptr to PxRigidDynamic instance that is the vehicle's physx representation. More...
 
PX_FORCE_INLINE const PxRigidDynamicgetRigidDynamicActor () const
 Get const ptr to PxRigidDynamic instance that is the vehicle's physx representation. More...
 
PxReal computeForwardSpeed () const
 Compute the rigid body velocity component along the forward vector of the rigid body transform. More...
 
PxReal computeSidewaysSpeed () const
 Compute the rigid body velocity component along the right vector of the rigid body transform. More...
 
virtual void requiresObjects (PxProcessPxBaseCallback &c)
 
virtual void preExportDataReset ()
 
virtual void exportExtraData (PxSerializationContext &)
 
void importExtraData (PxDeserializationContext &)
 
void resolveReferences (PxDeserializationContext &)
 
PX_FORCE_INLINE PxU32 getNbNonDrivenWheels () const
 
 PxVehicleWheels (PxType concreteType, PxBaseFlags baseFlags)
 
 PxVehicleWheels (PxBaseFlags baseFlags)
 
virtual ~PxVehicleWheels ()
 
virtual void release ()
 Releases the PxBase instance, please check documentation of release in derived class. More...
 
- Public Member Functions inherited from PxBase
template<class T >
T * is ()
 
template<class T >
const T * is () const
 
PX_FORCE_INLINE PxType getConcreteType () const
 Returns concrete type of object. More...
 
PX_FORCE_INLINE void setBaseFlag (PxBaseFlag::Enum flag, bool value)
 Set PxBaseFlag. More...
 
PX_FORCE_INLINE void setBaseFlags (PxBaseFlags inFlags)
 Set PxBaseFlags. More...
 
PX_FORCE_INLINE PxBaseFlags getBaseFlags () const
 Returns PxBaseFlags. More...
 
virtual bool isReleasable () const
 Whether the object is subordinate. More...
 

Static Public Member Functions

static PxVehicleDriveTankallocate (const PxU32 nbWheels)
 Allocate a PxVehicleTankDrive instance for a tank with nbWheels. More...
 
static PxVehicleDriveTankcreate (PxPhysics *physics, PxRigidDynamic *vehActor, const PxVehicleWheelsSimData &wheelsData, const PxVehicleDriveSimData &driveData, const PxU32 nbDrivenWheels)
 Allocate and set up a tank using simulation data for the wheels and drive model. More...
 
static PxVehicleDriveTankcreateObject (PxU8 *&address, PxDeserializationContext &context)
 
static void getBinaryMetaData (PxOutputStream &stream)
 
- Static Public Member Functions inherited from PxVehicleDrive
static void getBinaryMetaData (PxOutputStream &stream)
 
- Static Public Member Functions inherited from PxVehicleWheels
static void getBinaryMetaData (PxOutputStream &stream)
 

Public Attributes

PxVehicleDriveSimData mDriveSimData
 Simulation data that models vehicle components. More...
 
- Public Attributes inherited from PxVehicleDrive
PxVehicleDriveDynData mDriveDynData
 Dynamics data of vehicle instance. More...
 
- Public Attributes inherited from PxVehicleWheels
PxVehicleWheelsSimData mWheelsSimData
 Data describing the setup of all the wheels/suspensions/tires. More...
 
PxVehicleWheelsDynData mWheelsDynData
 Data describing the dynamic state of all wheels/suspension/tires. More...
 

Protected Member Functions

 PxVehicleDriveTank ()
 
 ~PxVehicleDriveTank ()
 
- Protected Member Functions inherited from PxVehicleDrive
bool isValid () const
 Test that all instanced dynamics data and configuration data have legal values. More...
 
void setToRestState ()
 Set vehicle to rest. More...
 
virtual void init (const PxU32 numWheels)
 
void free ()
 Deallocate a PxVehicle4WDrive instance. More...
 
void setup (PxPhysics *physics, PxRigidDynamic *vehActor, const PxVehicleWheelsSimData &wheelsData, const PxU32 nbDrivenWheels, const PxU32 nbNonDrivenWheels)
 
 PxVehicleDrive (PxType concreteType, PxBaseFlags baseFlags)
 
 ~PxVehicleDrive ()
 
- Protected Member Functions inherited from PxVehicleWheels
void setToRestState ()
 Set all wheels to their rest state. More...
 
bool isValid () const
 Test that all configuration and instanced dynamics data is valid. More...
 
void free ()
 Deallocate a PxVehicleWheels instance. More...
 
void onConstraintRelease ()
 
void setup (PxPhysics *physics, PxRigidDynamic *vehActor, const PxVehicleWheelsSimData &wheelsData, const PxU32 nbDrivenWheels, const PxU32 nbNonDrivenWheels)
 
- Protected Member Functions inherited from PxBase
PX_INLINE PxBase (PxType concreteType, PxBaseFlags baseFlags)
 Constructor setting concrete type and base flags. More...
 
PX_INLINE PxBase (PxBaseFlags baseFlags)
 Deserialization constructor setting base flags. More...
 
virtual ~PxBase ()
 Destructor. More...
 
template<class T >
bool typeMatch () const
 

Private Member Functions

bool isValid () const
 Test if the instanced dynamics and configuration data has legal values. More...
 

Private Attributes

PxVehicleDriveTankControlModel::Enum mDriveModel
 Drive model. More...
 
PxU32 mPad [3]
 

Friends

class PxVehicleUpdate
 

Additional Inherited Members

- Static Protected Member Functions inherited from PxVehicleDrive
static PxU32 computeByteSize (const PxU32 numWheels)
 
static PxU8 * patchupPointers (const PxU32 nbWheels, PxVehicleDrive *vehDrive, PxU8 *ptr)
 
- Static Protected Member Functions inherited from PxVehicleWheels
static PxU32 computeByteSize (const PxU32 nbWheels)
 
static PxU8 * patchupPointers (const PxU32 nbWheels, PxVehicleWheels *vehWheels, PxU8 *ptr)
 
- Protected Attributes inherited from PxVehicleWheels
PxRigidDynamicmActor
 The rigid body actor that represents the vehicle in the PhysX SDK. More...
 
PxU8 mType
 Vehicle type (eVehicleDriveTypes) More...
 
PxU8 mPad0 [14]
 
- Protected Attributes inherited from PxBase
PxType mConcreteType
 
PxBaseFlags mBaseFlags
 

Detailed Description

Data structure with instanced dynamics data and configuration data of a tank.

Constructor & Destructor Documentation

◆ PxVehicleDriveTank() [1/2]

PxVehicleDriveTank::PxVehicleDriveTank ( PxBaseFlags  baseFlags)
inline

◆ PxVehicleDriveTank() [2/2]

PxVehicleDriveTank::PxVehicleDriveTank ( )
protected

◆ ~PxVehicleDriveTank()

PxVehicleDriveTank::~PxVehicleDriveTank ( )
inlineprotected

Member Function Documentation

◆ allocate()

static PxVehicleDriveTank* PxVehicleDriveTank::allocate ( const PxU32  nbWheels)
static

Allocate a PxVehicleTankDrive instance for a tank with nbWheels.

Parameters
[in]nbWheelsis the number of wheels on the vehicle.
Note
It is assumed that all wheels are driven wheels.
Returns
The instantiated vehicle.
See also
free, setup

◆ create()

static PxVehicleDriveTank* PxVehicleDriveTank::create ( PxPhysics physics,
PxRigidDynamic vehActor,
const PxVehicleWheelsSimData wheelsData,
const PxVehicleDriveSimData driveData,
const PxU32  nbDrivenWheels 
)
static

Allocate and set up a tank using simulation data for the wheels and drive model.

Parameters
[in]physicsis a PxPhysics instance that is needed to create special vehicle constraints that are maintained by the tank.
[in]vehActoris a PxRigidDynamic instance that is used to represent the tank in the PhysX SDK.
[in]wheelsDatadescribes the configuration of all suspension/tires/wheels of the tank. The tank instance takes a copy of this data.
[in]driveDatadescribes the properties of the tank's drive model (gears/engine/clutch/differential/autobox). The tank instance takes a copy of this data.
[in]nbDrivenWheelsis the number of wheels on the tank.
Note
It is assumed that the first shapes of the actor are the wheel shapes, followed by the chassis shapes. To break this assumption use PxVehicleWheelsSimData::setWheelShapeMapping.
Returns
The instantiated vehicle.
See also
allocate, free, setToRestState, PxVehicleWheelsSimData::setWheelShapeMapping

◆ createObject()

static PxVehicleDriveTank* PxVehicleDriveTank::createObject ( PxU8 *&  address,
PxDeserializationContext context 
)
static

◆ free()

void PxVehicleDriveTank::free ( )

Deallocate a PxVehicleDriveTank instance.

See also
allocate

◆ getBinaryMetaData()

static void PxVehicleDriveTank::getBinaryMetaData ( PxOutputStream stream)
static

◆ getConcreteTypeName()

virtual const char* PxVehicleDriveTank::getConcreteTypeName ( ) const
inlinevirtual

Returns string name of dynamic type.

Returns
Class name of most derived type of this object.

Reimplemented from PxVehicleDrive.

◆ getDriveModel()

PxVehicleDriveTankControlModel::Enum PxVehicleDriveTank::getDriveModel ( ) const
inline

Return the control model used by the tank.

◆ isKindOf()

virtual bool PxVehicleDriveTank::isKindOf ( const char *  superClass) const
inlinevirtual

Returns whether a given type name matches with the type of this instance.

Reimplemented from PxVehicleDrive.

References PxBase::isKindOf().

◆ isValid()

bool PxVehicleDriveTank::isValid ( ) const
private

Test if the instanced dynamics and configuration data has legal values.

◆ setDriveModel()

void PxVehicleDriveTank::setDriveModel ( const PxVehicleDriveTankControlModel::Enum  driveModel)
inline

Set the control model used by the tank.

Note
eDRIVE_MODEL_STANDARD: turning achieved by braking on one side, accelerating on the other side.
eDRIVE_MODEL_SPECIAL: turning achieved by accelerating forwards on one side, accelerating backwards on the other side.
The default value is eDRIVE_MODEL_STANDARD

◆ setToRestState()

void PxVehicleDriveTank::setToRestState ( )

Set a vehicle to its rest state. Aside from the rigid body transform, this will set the vehicle and rigid body to the state they were in immediately after setup or create.

Note
Calling setToRestState invalidates the cached raycast hit planes under each wheel meaning that suspension line raycasts need to be performed at least once with PxVehicleSuspensionRaycasts before calling PxVehicleUpdates.
See also
setup, create, PxVehicleSuspensionRaycasts, PxVehicleUpdates

◆ setup()

void PxVehicleDriveTank::setup ( PxPhysics physics,
PxRigidDynamic vehActor,
const PxVehicleWheelsSimData wheelsData,
const PxVehicleDriveSimData driveData,
const PxU32  nbDrivenWheels 
)

Set up a tank using simulation data for the wheels and drive model.

Parameters
[in]physicsis a PxPhysics instance that is needed to create special vehicle constraints that are maintained by the vehicle.
[in]vehActoris a PxRigidDynamic instance that is used to represent the tank in the PhysX SDK.
[in]wheelsDatadescribes the configuration of all suspension/tires/wheels of the tank. The tank instance takes a copy of this data.
[in]driveDatadescribes the properties of the tank's drive model (gears/engine/clutch/autobox). The tank instance takes a copy of this data.
[in]nbDrivenWheelsis the number of wheels on the tank.
Note
It is assumed that the first shapes of the actor are the wheel shapes, followed by the chassis shapes. To break this assumption use PxVehicleWheelsSimData::setWheelShapeMapping.
See also
allocate, free, setToRestState, PxVehicleWheelsSimData::setWheelShapeMapping
Note
nbDrivenWheels must be an even number
The wheels must be arranged according to PxVehicleDriveTankWheelOrder; that is, the even wheels are on the left side of the tank and the odd wheels are on the right side of the tank.

Friends And Related Function Documentation

◆ PxVehicleUpdate

friend class PxVehicleUpdate
friend

Member Data Documentation

◆ mDriveModel

PxVehicleDriveTankControlModel::Enum PxVehicleDriveTank::mDriveModel
private

◆ mDriveSimData

PxVehicleDriveSimData PxVehicleDriveTank::mDriveSimData

Simulation data that models vehicle components.

See also
setup, create

◆ mPad

PxU32 PxVehicleDriveTank::mPad[3]
private

The documentation for this class was generated from the following file: