diff ai/steer.d @ 20:6efd0830715b

ai work
author zzzzrrr <mason.green@gmail.com>
date Wed, 25 Mar 2009 15:25:25 -0400
parents 08ddf9e71b88
children cad384ad349e
line wrap: on
line diff
--- a/ai/steer.d	Wed Mar 25 14:44:47 2009 -0400
+++ b/ai/steer.d	Wed Mar 25 15:25:25 2009 -0400
@@ -159,7 +159,7 @@
             if(o is m_body) continue;
             
             // This code which presumes the obstacle is spherical
-            findNextIntersectionWithSphere(o, next);
+            findNextIntersectionWithSphere(o, next, minDistanceToCollision);
 
             if (!nearest.intersect || (next.intersect && next.distance < nearest.distance)) {
 					nearest = next;
@@ -184,7 +184,7 @@
     }
 
 		void findNextIntersectionWithSphere(bzBody obs, 
-                                            inout PathIntersection intersection) {
+                                            inout PathIntersection intersection, float mdc) {
                                                 
 			// This routine is based on the Paul Bourke's derivation in:
 			//   Intersection of a Line and a Sphere (or circle)
@@ -211,7 +211,7 @@
                 }
             }
         
-			c = square(lc.x) + square(lc.y) - square(obsRadius + m_radius);
+			c = square(lc.x) + square(lc.y) - square(obsRadius + m_radius+mdc);
 			d = (b * b) - (4 * c);
             
 			// when the path does not intersect the sphere