BabylonJS / BabylonToolkit

Home of the community maintained Unity & Unreal exporters for Babylon.js
173 stars 46 forks source link

Babylon Toolkit

The Babylon Toolkit Extension is an advanced game development framework that provides modern game engine mechanics for BabylonJS.

Documentation

https://doc.babylonjs.com/communityExtensions/Unity

Download Files

https://github.com/BabylonJS/BabylonToolkit/tree/master/Editors https://github.com/BabylonJS/BabylonToolkit/tree/master/Runtime https://github.com/BabylonJS/BabylonToolkit/tree/master/Modules https://github.com/BabylonJS/BabylonToolkit/tree/master/Snippets

Runtime Library

The babylon.toolkit.js runtime library must be loaded in your host environment:

<script type="text/javascript" src="https://github.com/BabylonJS/BabylonToolkit/raw/master/scripts/babylon.toolkit.js"></script>

Or at runtime:

await BABYLON.Tools.LoadScriptAsync("scripts/babylon.toolkit.js");

Or on playgrounds:

 await TOOLKIT.SceneManager.InitializePlayground(engine);

Or node package manager:

 npm install babylon-toolkit

Node Package Manager

A universal runtime library packaged for UMD and ES6 projects.

https://www.npmjs.com/package/babylon-toolkit

Content Creation Tools

The Unity GLTF Exporter and Unreal GLTF Exporter plugins allow you to export interactive content from the game engine editor

Entity Component System

The Script Component is the foundation of the babylon toolkit extended framework. It was modeled after Unity's MonoBehavior class:

namespace PROJECT {
    export class SampleScript extends TOOLKIT.ScriptComponent {
        constructor(transform:BABYLON.TransformNode, scene:BABYLON.Scene, properties:any=null) {
           super(transform, scene, properties, "PROJECT.SampleScript");
        }

        protected awake(): void {
            /* Init component function */
        }

        protected start(): void {
            /* Start component function */
        }

        protected ready(): void {
            /* Execute when ready function */
        }

        protected update(): void {
            /* Update render loop function */
        }

        protected late(): void {
            /* Late update render loop function */
        }

        protected step(): void {
            /* Before physics step function (remove empty function for performance) */
        }

        protected fixed(): void {
            /* After physics step function (remove empty function for performance) */
        }

        protected after(): void {
            /* After update render loop function */
        }

        protected reset(): void {
            /* Reset component function */
        }

        protected destroy(): void {
            /* Destroy component function */
        }
    }
}

Getting Started

Your First TypeScript Playground (TS)

Your First JavaScript Playground (JS)

Unity Starter Content

TypeScript Starter Playground (TS)

JavaScript Starter Playground (JS)

Scene Manager Class

The TOOLKIT.SceneManager class provides runtime life cycle management for game objects. The extension supports a scene component application programming interface to enable the usage of modern game mechanics to ease web game development and provide a native game editor style development experience.

Window Manager Class

The TOOLKIT.WindowManager class provides DOM Level helper functions.

Input Controller Class

The TOOLKIT.InputController class provides game engine style user input functions.