Import a 3d scene into babylonJS

2019-05-09 16:16发布

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

标签: 3d blender
1条回答
神经病院院长
2楼-- · 2019-05-09 16:42

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

查看更多
登录 后发表回答