Import a 3d scene into babylonJS

不问归期 提交于 2019-12-07 14:24:49

问题


So I read today about babylonJS and I was blown away by it. I'm trying to figure out how to load an entire 3d scene into babylon. I've managed to export a 3d model of spider man and have the .babylon file but then what? In the document it only states
"Importing scene from 3D assets
Babylon.js can load scenes from a file format called .babylon. This file format is based on JSON and contains all required data to create a complete scene."

Any ideas on how to achieve this? Thanks


回答1:


Once you have a .babylon file, you can call the SceneLoader.Load function:

BABYLON.SceneLoader.Load("", "scene.babylon", engine, function (newScene) {

});

the Load function takes the following parameters:

  • scene folder (can be empty to use the same folder as your page)
  • scene file name
  • a reference to the engine
  • a callback to give you the loaded scene (in my case, I use this callback to attach the camera to the canvas and to launch my render loop)
  • a callback for progress report

More details here: https://www.eternalcoding.com/?p=313



来源:https://stackoverflow.com/questions/17354398/import-a-3d-scene-into-babylonjs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!