dot production
authornireco
Mon, 24 Nov 2008 21:36:00 +0000
changeset 100 29c3d91cad82
parent 99 c9b96dcfe4ee
child 101 1c52bd7fbc43
dot production
src/proto2/Physics.cc
--- a/src/proto2/Physics.cc	Mon Nov 24 21:32:41 2008 +0000
+++ b/src/proto2/Physics.cc	Mon Nov 24 21:36:00 2008 +0000
@@ -341,8 +341,8 @@
  */
 void PhysicsObject::bounce (Vector normal) {
     Vector tangent(normal.y, -normal.x);
-    Vector tprojection = (velocity * tangent) / tangent.length();
-    Vector nprojection = (velocity * normal) / normal.length();
+    Vector tprojection = (velocity * tangent)*tangent / (tangent.length()*tangent.length());
+    Vector nprojection = (velocity * normal)*normal / (normal.length()*normal.length());
     velocity = tprojection - nprojection;
 }