src/proto2/Physics.cc
changeset 160 ba0b6f421a3c
parent 159 109c7612ae2d
child 161 ea2f295c279f
equal deleted inserted replaced
159:109c7612ae2d 160:ba0b6f421a3c
   292 void PhysicsObject::bounce (Vector normal) {
   292 void PhysicsObject::bounce (Vector normal) {
   293     if (normal.length() != 0) {
   293     if (normal.length() != 0) {
   294         // Engine::log(DEBUG, "PhysicsObject.bounce") << "Velocity: " << velocity;
   294         // Engine::log(DEBUG, "PhysicsObject.bounce") << "Velocity: " << velocity;
   295         Vector nvel = velocity;
   295         Vector nvel = velocity;
   296         //        Engine::log(DEBUG, "PhysicsObject.bounce") << "New Velocity: " << nvel;
   296         //        Engine::log(DEBUG, "PhysicsObject.bounce") << "New Velocity: " << nvel;
   297         nvel = nvel - (2*((nvel*normal)/(normal*normal))*normal);
   297 //        nvel = nvel - ((1+COLLISION_ELASTICITY)*((nvel*normal)/(normal*normal))*normal);
   298         //        Engine::log(DEBUG, "PhysicsObject.bounce") << "Projection: " << nvel;
   298         
       
   299         nvel = nvel - ((2)*((nvel*normal)/(normal*normal))*normal);
       
   300 //        Engine::log(DEBUG, "PhysicsObject.bounce") << "Projection: " << nvel;
   299         velocity = nvel;
   301         velocity = nvel;
   300         this->velocity *= COLLISION_ELASTICITY;
   302         this->velocity *= COLLISION_ELASTICITY;
   301     }
   303     }
   302 }
   304 }
   303 
   305