Book Image

Babylon.js Essentials

By : Julien Moreau-Mathis
Book Image

Babylon.js Essentials

By: Julien Moreau-Mathis

Overview of this book

Are you familiar with HTML5? Do you want to build exciting games and Web applications? Then explore the exciting world of game and Web development with one of the best frameworks out there: Babylon.JS. Starting from the beginning, the book introduces the required basics for 3D development and the knowledge you need to use the Babylon.js framework. It focuses on the simplicity provided by Babylon.js and uses a combination of theory and practice. All the chapters are provided with example files ready to run; each example file provides the previously learned features of the framework. Finally, developers will be ready to easily understand new features added to the framework in the future.
Table of Contents (15 chapters)
Babylon.js Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Loading scenes with Babylon.js programmatically


To load scenes using TypeScript, Babylon.js provides you with a class named BABYLON.SceneLoader. This class contains static methods that allow you to load scenes (create new ones), append scenes, and load meshes.

Basically, as a developer, you'll load files using these methods. The .Load method creates a new scene for you and loads everything (meshes, lights, particle systems, camera, and so on), returning the new scene. The.Append method takes an existing scene as a parameter and appends a new scene to the existing one (useful to mix multiple scenes). Finally, the.ImportMesh method imports only meshes, skeletons (refer to Chapter 9Create and Play Animations about animations), and particle systems to an existing scene. The following steps will show you how to use these methods and find the right way to manage your scenes.

The BABYLON.SceneLoader class

Loading a scene: The way to load scenes is pretty easy. Just call the BABYLON.SceneLoader...