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