浏览代码

Apply hierarchy transform on world models

trethaller 7 年之前
父节点
当前提交
9db91f1452
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      h3d/scene/World.hx

+ 6 - 0
h3d/scene/World.hx

@@ -256,6 +256,12 @@ class World extends Object {
 			var geom = lib.header.geometries[m.geometry];
 			if( geom == null ) continue;
 			var pos = m.position.toMatrix();
+			var parentIdx = m.parent;
+			while(parentIdx >= 0) {
+				var parent = models[parentIdx];
+				pos.multiply(parent.position.toMatrix(), pos);
+				parentIdx = parent.parent;
+			}
 			for( mid in 0...m.materials.length ) {
 				var mat = lib.header.materials[m.materials[mid]];
 				if(mat == null || mat.diffuseTexture == null) continue;