babylonjs/editor/babylonjs-editor-tools

Claude Code and agent skill by babylonjs/editor

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Write and attach TypeScript scripts, load scenes, and use the editor decorators and runtime helpers in projects created with the Babylon.js Editor (the babylonjs-editor-tools runtime package). Use when working with files like src/scripts/*.ts, src/scripts.ts, or App.ts that import from "babylonjs-editor-tools", or whenever the task mentions editor scripts, IScript onStart/onUpdate, loadScene, AdvancedAssetContainer, the @nodeFromScene / @visibleAs* / @onPointerEvent / @sceneAsset / @visibleAsAsset decorators, or runtime helpers such as getScriptByClassForObject, applyScriptOnObject, cinematics, sprites, sounds, ragdolls, navmeshes, decals, post-processes or the offline assets database.

Install

npx vskill@latest install babylonjs/editor/babylonjs-editor-tools

SKILL.md

The same SKILL.md was published earlier as babylonjs/editor/babylonjs-editor-tools.

babylonjs-editor-tools

babylonjs-editor-tools is the runtime library bundled into every project exported or packaged by the Babylon.js Editor. It is what user game code (src/scripts/*.ts) and the app bootstrap (App.ts / page.tsx / app.vue) import. It provides:

  1. A scene loader (loadScene) that reconstructs everything the editor saved and re-attaches scripts.
  2. A script contract (IScript: onStart / onUpdate / onStop).
  3. Decorators used inside scripts to retrieve scene objects, expose customizable inspector fields,

link assets, and listen to input events.

  1. Runtime helpers to find or attach scripts, play cinematics and sprite animations, drive sounds,

post-processes, ragdolls, navmeshes and decals, and cache assets offline.

Everything is imported from the package root:

ts
import { loadScene, nodeFromScene, visibleAsNumber, onPointerEvent } from "babylonjs-editor-tools";

Mental model (read this first)

  • A script is a default-exported class (recommended) or a set of exported functions, attached to a scene

object in the editor (mesh, transform node, light, camera, sprite, or the scene itself).

  • The object the script is attached to is passed to the constructor (class) or as the first argument

(functions). Conventionally the parameter is named after the type, e.g. public mesh: Mesh.

  • Decorators are applied by the loader right after construction, before onStart. **Inside the

constructor, decorated properties still hold their initializer values** (the values set in the editor and the linked objects/assets are not assigned yet) — only use them from onStart onward.

  • Decorators only work on class-based scripts, not function-based scripts.
  • The editor works in centimeters and auto-scales glTF/GLB imports ×100 — keep that in mind for any

positions, speeds, or distances you compute (gravity is -981).

When the editor's MCP tools are available

In the editor's AI assistant (or any agent connected to the babylonjs-editor MCP server), author the scene with the MCP tools — meshes, materials, instances, lights, cameras, particles, physics, decals — so the user can edit the result by hand. Scripts written with this package are for runtime behavior only (input, game rules, AI, reacting to events, spawning copies of authored assets). Write them under src/, attach them with the MCP script tools, and set their @visibleAs* values from the editor rather than hard-coding them.

Quick reference

Lifecycle (IScript)
MethodCalled
onStart(object)Once, before the first frame after the script loads and the scene is ready.
onUpdate(object)Every rendered frame. Use scene.getAnimationRatio() for frame-rate independence.
onStop(object)When the script is stopped or the object is disposed.
Retrieving scene objects — see references/scene-decorators.md
DecoratorRetrieves
@nodeFromScene(name)First node (Mesh / TransformNode / Light / Camera) with that name, anywhere in the scene.
@nodeFromDescendants(name, directOnly?)Same, but only among descendants of the attached object.
@animationGroupFromScene(name)An AnimationGroup by name.
@particleSystemFromScene(name, directOnly?)A particle system by name (directOnly: only the ones emitted by the attached object).
@soundFromScene(name)A SoundNode by name.
@spriteFromSpriteManager(name)A sprite of the manager (scripts on a SpriteManagerNode).
@animationFromSprite(name)An ISpriteAnimation of the sprite (scripts on a Sprite).
@componentFromScene(OtherScriptClass)The single instance of another script class in the scene.
@sceneAsset(file)A .scene loaded as an AdvancedAssetContainer (instantiate on demand).
Customizable inspector fields — see references/inspector-decorators.md

@visibleAsBoolean, @visibleAsNumber, @visibleAsString, @visibleAsVector2, @visibleAsVector3, @visibleAsColor3, @visibleAsColor4, @visibleAsEntity, @visibleAsTexture, @visibleAsKeyMap. Each makes a property editable per-object in the editor inspector; { group } sorts fields into sections.

Linking assets — see references/asset-decorators.md

@visibleAsAsset(type, label, config?) links a property to a project asset (json, material, gui, scene, nodeParticleSystemSet, navmesh, cinematic, ragdoll). Preloaded during scene load.

Input events — see references/event-decorators.md

@onPointerEvent(type | type[], { mode }) and @onKeyboardEvent(type | type[]) call the decorated method when the event fires. Pointer mode can be global (default), attachedMeshOnly, or includeDescendants.

Loading scenes — see references/loading-scenes.md

await loadScene(rootUrl, sceneFilename, scene, scriptsMap, options?) appends a saved .babylon scene, preloads script assets, configures lights/shadows/LODs/physics/post-processing, and attaches every script.

Instantiating sub-scenes — see references/scene-containers.md

AdvancedAssetContainer (from @sceneAsset or @visibleAsAsset("scene")) — .removeDefault(), .instantiate(options?), .getRootNodeByName(), .getScriptByClassByObjectName().

Runtime helpers — see references/runtime-helpers.md
NeedHelper
Get the script instance on an objectgetScriptByClassForObject(object, Class) / getAllScriptsByClassForObject
Attach a script at runtimeapplyScriptOnObject(object, Class)
Play a cinematicparseCinematic + generateCinematicAnimationGroup → Cinematic.onEvent(...)
Play a sprite animation by nameplaySpriteAnimationFromName(sprite, name, onEnd?)
Tune a post-processgetDefaultRenderingPipeline(), getSSAO2RenderingPipeline(), …
Ragdolls / navmeshes / decalsapplyRagdollJointLimits, RecastNavigationHelper, setStaticDecalsEnabled
Load assets offline / fastersetupOfflineProvider, preloadAssetsToDatabase, forceCompileAllSceneMaterials

Minimal class-based script

ts
import { Mesh } from "@babylonjs/core/Meshes/mesh";
import { visibleAsNumber } from "babylonjs-editor-tools";
export default class RotateScript {
@visibleAsNumber("Rotation Speed", { min: 0, max: 10, step: 0.1 })
private _speed: number = 1;
public constructor(public mesh: Mesh) {
// ⚠️ _speed is still 1 here: the value set in the editor is applied after the constructor.
}
public onStart(): void {
// ✅ decorated properties are now resolved.
}
public onUpdate(): void {
this.mesh.rotation.y += this._speed * this.mesh.getScene().getAnimationRatio();
}
}

Conventions to follow when authoring scripts

  • Default-export one class per file; name the file in kebab-case (e.g. rotate-script.ts).
  • Type decorated reference properties as nullable (Mesh | null = null) and guard before use, since they

resolve only after construction.

  • Never read decorated properties in the constructor.
  • Never edit the generated src/scripts.ts: the editor rewrites it.
  • Match the repo's Prettier style: tabs, double quotes, semicolons, printWidth 180.
  • Import Babylon.js symbols from deep paths (@babylonjs/core/Meshes/mesh) to keep tree-shaking working,

exactly like the templates and documentation examples do.

For full details and runnable examples, open the matching file under references/.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1,112
Repository forks
302
7-day trend score
35

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/babylonjs/editor/babylonjs-editor-tools/badge)](https://verified-skill.com/skills/babylonjs/editor/babylonjs-editor-tools)

Something wrong with this skill or its page? Tell us.