Explorar o código

fix capsule when height is zero (#575)

Tom SPIRA %!s(int64=6) %!d(string=hai) anos
pai
achega
faca6425a7
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      h3d/col/Capsule.hx

+ 6 - 0
h3d/col/Capsule.hx

@@ -26,6 +26,12 @@ class Capsule implements Collider {
 		var RD = r.getDir();
 
 		var ABdotAB = AB.dot(AB);
+
+		if (ABdotAB == 0) {
+			tmpSphere.load(this.a.x, this.a.y, this.a.z, this.r);
+			return tmpSphere.rayIntersection(r, bestMatch);
+		}
+
 		var m = AB.dot(RD) / ABdotAB;
 		var n = AB.dot(AO) / ABdotAB;