The Babylon Toolkit provides modern game engine mechanics with a familiar Unity like scripting system to fast track native web game development using BabylonJS.
https://github.com/BabylonJS/BabylonToolkit/tree/master/Reference
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
The babylon.toolkit.js runtime library must be loaded in your host environment:
<script type="text/javascript" src="scripts/babylon.toolkit.js"></script>
Or at runtime:
await BABYLON.Tools.LoadScriptAsync("scripts/babylon.toolkit.js");
Or on playgrounds:
await TOOLKIT.SceneManager.InitializeRuntime(engine);
Or node package manager (UMD):
npm install babylonjs-toolkit
Or node package manager (ES6):
npm install @babylonjs-toolkit/next
Universal runtime library packages.
UMD - https://www.npmjs.com/package/babylonjs-toolkit
ES6 - https://www.npmjs.com/package/@babylonjs-toolkit/next
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 = {}, alias: string = "PROJECT.SampleScript") {
super(transform, scene, properties, alias);
}
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 */
}
}
}
Your First TypeScript Playground (TS)
The @codewrx Copilot Agent and ChatGPT Agent have been extensively trained for web game development
The Unity Exporter and Unreal Exporter plugins allow you to export interactive GLTF content and scripts