
Melonjs 3d Assets
Use this skill when loading 3D models into melonJS, glTF and GLB scenes, OBJ/MTL...
Install
npx skills add melonjs/melonJS --skill melonjs-3d-assets -g -a claude-code -y- Repository
- melonjs/melonJS6.4k
- Category
- Design
- Updated
- 3d ago
- License
- MIT
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
Use this skill when loading 3D models into melonJS, glTF and GLB scenes, OBJ/MTL models, materials, imported lights, node animation, ground shadows and GPU instancing. Covers level.load options including the async flag, the rightHanded conversion, and exactly what the loader does and does not support. Triggers on: glTF, gltf, glb, OBJ, MTL, 3D model, getGLTF, getOBJ, getMTL, GLTFModel, GLTFScene, level.load glb, rightHanded, lightIntensityScale, castGroundShadow, shadowGroundY, EXT_mesh_gpu_instancing, KHR_lights_punctual, skinning, Blender export, 3D asset.
Loading 3D assets
glTF/GLB is the primary path for 3D content, and it goes through the level director rather than the world directly:
level.load("scene"), the same call a Tiled map uses. OBJ/MTL is the simpler path for a single static model.
Loading a glTF/GLB scene
await loader.preload([
{ name: "diorama", type: "glb", src: "data/scenes/diorama.glb" },
]);
level.load("diorama", { scale: 50 });
type: "gltf" (JSON plus external buffers) and type: "glb" (single binary)
are both loader types. A self-contained GLB is the better shipping format, one
request, nothing to resolve relatively.
The scene loads under whatever camera the stage has; view it under a Camera3d
or it renders flat. See melonjs-3d for the camera.
level.load options for glTF/GLB
| option | default | what it does |
|---|---|---|
scale | 1 | pixels per glTF unit, applied to the whole scene. Blender's metre-scale export usually needs 20, 100. |
container | game.world | where the nodes are added |
onLoaded | game.onLevelLoaded | called with the level id, not the scene |
async | false | return a promise that settles once the scene is in the world, instead of a boolean |
rightHanded | true | see below |
lights | true | instantiate authored KHR_lights_punctual lights as Light3d world children |
lightIntensityScale | , | keep authored intensity ratios instead of normalising every light to 1 |
Those game. defaults are the engine's, not a recommendation. game is
whichever Application finished init() last, so pass container
explicitly from a Stage, where the right one is in your hand:


