Browse Source

added getPoint

Nicolas Cannasse 2 years ago
parent
commit
912316ba91
1 changed files with 13 additions and 0 deletions
  1. 13 0
      h3d/scene/Interactive.hx

+ 13 - 0
h3d/scene/Interactive.hx

@@ -65,6 +65,19 @@ class Interactive extends Object implements hxd.SceneEvents.Interactive {
 		cursor = Button;
 	}
 
+	public function getPoint( ray : h3d.col.Ray, bestMatch : Bool ) {
+		var rold = ray.clone();
+		ray.transform(getInvPos());
+		var d = shape.rayIntersection(ray, bestMatch);
+		if( d < 0 ) {
+			ray.load(rold);
+			return null;
+		}
+		var pt = ray.getPoint(d);
+		pt.transform(getAbsPos());
+		ray.load(rold);
+		return pt;
+	}
 
 	inline function get_showDebug() return debugObj != null;