equal
deleted
inserted
replaced
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 |