1dcec69a335971b4aac8c7daa6951d0291fa63ca
[blender-staging.git] / source / gameengine / Physics / common / PHY_IVehicle.h
1
2 /** \file PHY_IVehicle.h
3  *  \ingroup phys
4  */
5
6 #ifndef __PHY_IVEHICLE_H__
7 #define __PHY_IVEHICLE_H__
8
9 //PHY_IVehicle provides a generic interface for (raycast based) vehicles. Mostly targetting 4 wheel cars and 2 wheel motorbikes.
10
11 class PHY_IMotionState;
12 #include "PHY_DynamicTypes.h"
13
14 #ifdef WITH_CXX_GUARDEDALLOC
15 #include "MEM_guardedalloc.h"
16 #endif
17
18 class PHY_IVehicle
19 {
20 public:
21         virtual ~PHY_IVehicle(){};
22         
23         virtual void    AddWheel(
24                         PHY_IMotionState* motionState,
25                         MT_Vector3      connectionPoint,
26                         MT_Vector3      downDirection,
27                         MT_Vector3      axleDirection,
28                         float   suspensionRestLength,
29                         float wheelRadius,
30                         bool hasSteering
31                 ) = 0;
32
33
34         virtual int             GetNumWheels() const = 0;
35         
36         virtual void    GetWheelPosition(int wheelIndex,float& posX,float& posY,float& posZ) const = 0;
37         virtual void    GetWheelOrientationQuaternion(int wheelIndex,float& quatX,float& quatY,float& quatZ,float& quatW) const = 0;
38         virtual float   GetWheelRotation(int wheelIndex) const = 0;
39
40         virtual int     GetUserConstraintId() const =0;
41         virtual int     GetUserConstraintType() const =0;
42
43         //some basic steering/braking/tuning/balancing (bikes)
44
45         virtual void    SetSteeringValue(float steering,int wheelIndex) = 0;
46
47         virtual void    ApplyEngineForce(float force,int wheelIndex) = 0;
48
49         virtual void    ApplyBraking(float braking,int wheelIndex) = 0;
50
51         virtual void    SetWheelFriction(float friction,int wheelIndex) = 0;
52         
53         virtual void    SetSuspensionStiffness(float suspensionStiffness,int wheelIndex) = 0;
54         
55         virtual void    SetSuspensionDamping(float suspensionStiffness,int wheelIndex) = 0;
56         
57         virtual void    SetSuspensionCompression(float suspensionStiffness,int wheelIndex) = 0;
58         
59         virtual void    SetRollInfluence(float rollInfluence,int wheelIndex) = 0;
60
61         virtual void    SetCoordinateSystem(int rightIndex,int upIndex,int forwardIndex) =0;
62
63
64 #ifdef WITH_CXX_GUARDEDALLOC
65         MEM_CXX_CLASS_ALLOC_FUNCS("GE:PHY_IVehicle")
66 #endif
67 };
68
69 #endif  /* __PHY_IVEHICLE_H__ */