瀏覽代碼

assetContainer create root mesh

Trevor Baron 7 年之前
父節點
當前提交
da386584cb
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      src/babylon.assetContainer.ts

+ 13 - 0
src/babylon.assetContainer.ts

@@ -332,5 +332,18 @@ module BABYLON {
 
             this.removeAllFromScene();
         }
+
+        /**
+         * Adds all meshes in the asset container to a root mesh that can be used to position the entire assetContainer
+         */
+        public createRootMesh(){
+            var rootMesh = new BABYLON.Mesh("assetContainerRootMesh", this.scene);
+            this.meshes.forEach((m)=>{
+                if(!m.parent){
+                    rootMesh.addChild(m);
+                }
+            })
+            return rootMesh;
+        }
     }
 }