some more work on bullet raycast
[blender.git] / source / gameengine / Ketsji / KX_BulletPhysicsController.cpp
1 //under visual studio the #define in KX_ConvertPhysicsObject.h is quicker for recompilation
2 #include "KX_ConvertPhysicsObject.h"
3
4 #ifdef USE_BULLET
5
6 #include "KX_BulletPhysicsController.h"
7
8 #include "Dynamics/RigidBody.h"
9
10 KX_BulletPhysicsController::KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna)
11 : KX_IPhysicsController(dyna,(PHY_IPhysicsController*)this),
12 CcdPhysicsController(ci)
13 {
14
15 }
16         
17 KX_BulletPhysicsController::~KX_BulletPhysicsController ()
18 {
19
20 }
21
22 void    KX_BulletPhysicsController::resolveCombinedVelocities(float linvelX,float linvelY,float linvelZ,float angVelX,float angVelY,float angVelZ)
23 {
24         CcdPhysicsController::resolveCombinedVelocities(linvelX,linvelY,linvelZ,angVelX,angVelY,angVelZ);
25
26 }
27
28
29         ///////////////////////////////////
30         //      KX_IPhysicsController interface
31         ////////////////////////////////////
32
33 void    KX_BulletPhysicsController::applyImpulse(const MT_Point3& attach, const MT_Vector3& impulse)
34 {
35                 CcdPhysicsController::applyImpulse(attach[0],attach[1],attach[2],impulse[0],impulse[1],impulse[2]);
36
37 }
38
39 void    KX_BulletPhysicsController::SetObject (SG_IObject* object)
40 {
41 }
42
43 void    KX_BulletPhysicsController::RelativeTranslate(const MT_Vector3& dloc,bool local)
44 {
45         CcdPhysicsController::RelativeTranslate(dloc[0],dloc[1],dloc[2],local);
46
47 }
48
49 void    KX_BulletPhysicsController::RelativeRotate(const MT_Matrix3x3& drot,bool local)
50 {
51         printf("he1\n");
52         float   rotval[12];
53         drot.getValue(rotval);
54
55
56         
57         printf("hi\n");
58         CcdPhysicsController::RelativeRotate(rotval,local);
59 }
60
61 void    KX_BulletPhysicsController::ApplyTorque(const MT_Vector3& torque,bool local)
62 {
63 }
64 void    KX_BulletPhysicsController::ApplyForce(const MT_Vector3& force,bool local)
65 {
66 }
67 MT_Vector3 KX_BulletPhysicsController::GetLinearVelocity()
68 {
69         assert(0);
70         return MT_Vector3(0.f,0.f,0.f);
71
72 }
73 MT_Vector3 KX_BulletPhysicsController::GetVelocity(const MT_Point3& pos)
74 {
75                 assert(0);
76         return MT_Vector3(0.f,0.f,0.f);
77
78 }
79 void    KX_BulletPhysicsController::SetAngularVelocity(const MT_Vector3& ang_vel,bool local)
80 {
81         CcdPhysicsController::SetAngularVelocity(ang_vel.x(),ang_vel.y(),ang_vel.z(),local);
82
83 }
84 void    KX_BulletPhysicsController::SetLinearVelocity(const MT_Vector3& lin_vel,bool local)
85 {
86         CcdPhysicsController::SetLinearVelocity(lin_vel.x(),lin_vel.y(),lin_vel.z(),local);
87 }
88 void    KX_BulletPhysicsController::getOrientation(MT_Quaternion& orn)
89 {
90 }
91 void KX_BulletPhysicsController::setOrientation(const MT_Quaternion& orn)
92 {
93 }
94 void KX_BulletPhysicsController::setPosition(const MT_Point3& pos)
95 {
96
97 }
98 void KX_BulletPhysicsController::setScaling(const MT_Vector3& scaling)
99 {
100 }
101 MT_Scalar       KX_BulletPhysicsController::GetMass()
102 {
103
104         MT_Scalar invmass = GetRigidBody()->getInvMass();
105         if (invmass)
106                 return 1.f/invmass;
107         return 0.f;
108
109 }
110 MT_Vector3      KX_BulletPhysicsController::getReactionForce()
111 {
112         assert(0);
113         return MT_Vector3(0.f,0.f,0.f);
114 }
115 void    KX_BulletPhysicsController::setRigidBody(bool rigid)
116 {
117 }
118
119 void    KX_BulletPhysicsController::SuspendDynamics()
120 {
121 }
122 void    KX_BulletPhysicsController::RestoreDynamics()
123 {
124 }
125
126 SG_Controller*  KX_BulletPhysicsController::GetReplica(class SG_Node* destnode)
127 {
128         assert(0);
129         return 0;
130 }
131
132
133
134 void    KX_BulletPhysicsController::SetSumoTransform(bool nondynaonly)
135 {
136 }
137
138 // todo: remove next line !
139 void    KX_BulletPhysicsController::SetSimulatedTime(double time)
140 {
141 }
142         
143 // call from scene graph to update
144 bool KX_BulletPhysicsController::Update(double time)
145 {
146         return false;
147
148         // todo: check this code
149         //if (GetMass())
150         //{
151         //      return false;//true;
152 //      }
153 //      return false;
154 }
155
156 #endif //#ifdef USE_BULLET