瀏覽代碼

added getAbsPos, getInvPos is now public

ncannasse 9 年之前
父節點
當前提交
0302177f80
共有 1 個文件被更改,包括 13 次插入2 次删除
  1. 13 2
      h3d/scene/Object.hx

+ 13 - 2
h3d/scene/Object.hx

@@ -185,12 +185,15 @@ class Object {
 		Transform a point from the global coordinates to the object local ones. The point is modified and returned.
 	**/
 	public function globalToLocal( pt : h3d.Vector ) {
-		syncPos();
 		pt.transform3x4(getInvPos());
 		return pt;
 	}
 
-	function getInvPos() {
+	/**
+		Returns the updated inverse position matrix. Please note that this is not a copy and should not be modified.
+	**/
+	public function getInvPos() {
+		syncPos();
 		if( invPos == null ) {
 			invPos = new h3d.Matrix();
 			invPos._44 = 0;
@@ -333,6 +336,14 @@ class Object {
 		while( p.parent != null ) p = p.parent;
 		return Std.instance(p, Scene);
 	}
+	
+	/**
+		Returns the updated absolute position matrix. Please note that this is not a copy so it should not be modified.
+	**/
+	public function getAbsPos() {
+		syncPos();
+		return absPos;
+	}
 
 	public inline function isMesh() {
 		return Std.instance(this, Mesh) != null;