فهرست منبع

added getTransform

Nicolas Cannasse 4 سال پیش
والد
کامیت
26a79dd050
1فایلهای تغییر یافته به همراه14 افزوده شده و 0 حذف شده
  1. 14 0
      h3d/scene/Object.hx

+ 14 - 0
h3d/scene/Object.hx

@@ -816,6 +816,20 @@ class Object implements hxd.impl.Serializable {
 		posChanged = true;
 	}
 
+	/**
+		Returns the local position, scale and rotation of the object relative to its parent.
+	**/
+	public function getTransform( ?mat : h3d.Matrix ) : h3d.Matrix {
+		if( mat == null ) mat = new h3d.Matrix();
+		mat.initScale(scaleX, scaleY, scaleZ);
+		qRot.toMatrix(tmpMat);
+		mat.multiply3x4(mat, tmpMat);
+		mat.tx = x;
+		mat.ty = y;
+		mat.tz = z;
+		return mat;
+	}
+
 	/**
 		Rotate around the current rotation axis by the specified angles (in radian).
 	**/