Răsfoiți Sursa

added Object.getRelPos()

Nicolas Cannasse 4 ani în urmă
părinte
comite
4e9d404861
1 a modificat fișierele cu 12 adăugiri și 0 ștergeri
  1. 12 0
      h3d/scene/Object.hx

+ 12 - 0
h3d/scene/Object.hx

@@ -552,6 +552,18 @@ class Object implements hxd.impl.Serializable {
 		return absPos;
 	}
 
+	/**
+		Returns the position matrix relative to another scene object
+	**/
+	public function getRelPos( obj : Object ) {
+		if( obj == null )
+			return getAbsPos();
+		syncPos();
+		var m = new h3d.Matrix();
+		m.multiply(absPos, obj.getInvPos());
+		return m;
+	}
+
 	/**
 		Tell if the object is a Mesh.
 	**/