浏览代码

added getPoint

Nicolas Cannasse 2 年之前
父节点
当前提交
912316ba91
共有 1 个文件被更改,包括 13 次插入0 次删除
  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;