Blender V2.61 - r43446

PHY_IVehicle.h

Go to the documentation of this file.
00001 
00006 #ifndef PHY_IVEHICLE_H
00007 #define PHY_IVEHICLE_H
00008 
00009 //PHY_IVehicle provides a generic interface for (raycast based) vehicles. Mostly targetting 4 wheel cars and 2 wheel motorbikes.
00010 
00011 class PHY_IMotionState;
00012 #include "PHY_DynamicTypes.h"
00013 
00014 #ifdef WITH_CXX_GUARDEDALLOC
00015 #include "MEM_guardedalloc.h"
00016 #endif
00017 
00018 class PHY_IVehicle
00019 {
00020 public:
00021     virtual ~PHY_IVehicle();
00022     
00023     virtual void    AddWheel(
00024             PHY_IMotionState* motionState,
00025             PHY__Vector3    connectionPoint,
00026             PHY__Vector3    downDirection,
00027             PHY__Vector3    axleDirection,
00028             float   suspensionRestLength,
00029             float wheelRadius,
00030             bool hasSteering
00031         ) = 0;
00032 
00033 
00034     virtual int     GetNumWheels() const = 0;
00035     
00036     virtual void    GetWheelPosition(int wheelIndex,float& posX,float& posY,float& posZ) const = 0;
00037     virtual void    GetWheelOrientationQuaternion(int wheelIndex,float& quatX,float& quatY,float& quatZ,float& quatW) const = 0;
00038     virtual float   GetWheelRotation(int wheelIndex) const = 0;
00039 
00040     virtual int GetUserConstraintId() const =0;
00041     virtual int GetUserConstraintType() const =0;
00042 
00043     //some basic steering/braking/tuning/balancing (bikes)
00044 
00045     virtual void    SetSteeringValue(float steering,int wheelIndex) = 0;
00046 
00047     virtual void    ApplyEngineForce(float force,int wheelIndex) = 0;
00048 
00049     virtual void    ApplyBraking(float braking,int wheelIndex) = 0;
00050 
00051     virtual void    SetWheelFriction(float friction,int wheelIndex) = 0;
00052     
00053     virtual void    SetSuspensionStiffness(float suspensionStiffness,int wheelIndex) = 0;
00054     
00055     virtual void    SetSuspensionDamping(float suspensionStiffness,int wheelIndex) = 0;
00056     
00057     virtual void    SetSuspensionCompression(float suspensionStiffness,int wheelIndex) = 0;
00058     
00059     virtual void    SetRollInfluence(float rollInfluence,int wheelIndex) = 0;
00060 
00061     virtual void    SetCoordinateSystem(int rightIndex,int upIndex,int forwardIndex) =0;
00062 
00063 
00064 #ifdef WITH_CXX_GUARDEDALLOC
00065 public:
00066     void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PHY_IVehicle"); }
00067     void operator delete( void *mem ) { MEM_freeN(mem); }
00068 #endif
00069 };
00070 
00071 #endif //PHY_IVEHICLE_H