Not sure if this is the right way. But a lot simpler it is.
authorsaiam
Sun, 30 Nov 2008 15:15:17 +0000
changeset 148 d6f2b9912449
parent 147 233789c40c07
child 149 ce4d8f12373a
Not sure if this is the right way. But a lot simpler it is.
src/proto2/Physics.cc
--- a/src/proto2/Physics.cc	Sun Nov 30 14:58:48 2008 +0000
+++ b/src/proto2/Physics.cc	Sun Nov 30 15:15:17 2008 +0000
@@ -280,10 +280,20 @@
  * Computes hitten wall's normal. Calculated from 3*3 grid
  */
 Vector PhysicsWorld::getNormal (Vector hitPoint, Vector prevPoint) {
+    // Why doesn't this work
+    Vector normal(0,0);
+    for (int i = 0; i < 8; i++) {
+        if (getType(hitPoint+DIRECTIONS[i]) == EMPTY)
+            normal += DIRECTIONS[i];
+    }
+    return normal;
+
+    /*
     // Search free points with bfs and put them to vector
     std::vector<Vector> frees;
     Vector hit(hitPoint);
-    Vector prev(prevPoint);
+    Vector pre(prevPoint);
+
 
     assert(hit != prev);
     
@@ -312,6 +322,7 @@
     }
     Engine::log(DEBUG, "physics.getNormal ") << "normal: " << normal;
     return normal;
+    */
 }
 
 /**