melonjs-3d-assets
यह क्या करती है
यह बताती है कि melonJS गेम में 3D दृश्य और मॉडल कैसे लाएँ और लोडर क्या सपोर्ट करता है और क्या नहीं। यह उन गेम डेवलपर्स के लिए है जिन्हें अपने ब्राउज़र गेम में 3D सामग्री चाहिए।
कब इस्तेमाल करें
- ✓जब डेवलपर glTF या GLB फ़ॉर्मेट का 3D दृश्य melonJS गेम में लोड करना चाहे।
- ✓जब डेवलपर को OBJ फ़ॉर्मेट में एक सरल स्थिर 3D मॉडल चाहिए।
- ✓जब डेवलपर का 3D मॉडल गेम में बहुत छोटा या बहुत बड़ा दिखे।
Skill का लिंक
https://github.com/melonjs/melonJS/blob/master/packages/melonjs/skills/melonjs-3d-assets/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इस GLB दृश्य को मेरे melonJS गेम में लोड कीजिए और उसका सही आकार कर दीजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह स्किल दिखाती है कि फ़ाइल को पहले से कैसे लोड करें और उसे स्तर सिस्टम से scale, lights और coordinate विकल्पों के साथ कैसे लाएँ। यह बताती है कि लोडर क्या सपोर्ट करता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
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:
level.load("sceneId", { container: this.app.world, scale: 40 });
| castGroundShadow | inherits the app setting (on) | blob shadows for this scene's meshes |
| shadowGroundY | each object's own base | world Y of the floor the blobs land on |
| shadowOpacity | 0.45 | how dark the blobs are |
| shadowScale | 1 | blob footprint multiplier; 0 or less hides them |
| shadowOffset | 0 | slide them along the light, in blob radii; needs shadowGroundY, which is the only way a scene load can name its floor |
| shadowStretch | 1 | lengthen them along it, clamped to 3 |
| shadowDirectionX / shadowDirectionZ | 0 | the ground direction they are cast along |
| shadowGroundNormal | world up | up normal of the floor, for a scene that is not level |
| shadowLight | — | a Light3d to take the direction from, re-read every draw |
shadowGroundPoint is not on that list, and a scene load drops it without
a warning. One floor POINT shared by every part of a scene would stack the
whole thing's blobs on a single spot, which is nonsense where one floor
HEIGHT is perfectly sensible. Ground that is not flat is a per-object answer:
set it on the parts you want once the load has finished.
onLoaded receives the level id — it is a "done" signal, not a handle on the
scene. You need it, or async: with the game loop running, level.load stops
the loop and defers the actual load to a timer, so by default it returns
before anything is in the world.
await level.load("diorama", { scale: 50, async: true });
// the scene is in the world here
Note await level.load("diorama") without the flag does not await the load — the
call returns a boolean, and await true resolves immediately. To get at what was
loaded, load into a container you own, or look the nodes up by their authored
names:
level.load("diorama", { scale: 50, onLoaded: () => {
const sun = app.world.getChildByName("Sun")[0]; // note: returns an array
sun.intensity = 2;
}});
The same options from a Tiled Trigger
A Trigger authored in Tiled forwards these to level.load(), so a trigger that
walks the player into a glTF level carries the scene's settings as Tiled
properties:
world.addChild(new Trigger(x, y, {
shapes: [new Rect(0, 0, 100, 100)],
to: "diorama", // the level id — `to`, not `level`
scale: 50,
rightHanded: false,
castGroundShadow: false,
}));
Every level.load option above travels, including the whole ground-shadow set,
and so do container, onLoaded, flatten and setViewportBounds. The list is
derived from level.loadOptions rather than restated, so an option added to
a level format arrives here for free. It used to be hand-written and had fallen
three releases behind the glTF pa
अक्सर पूछे जाने वाले सवाल
मेरा मॉडल गलत आकार का क्यों है?
स्किल समझाती है कि scale सेटिंग मॉडल की इकाइयों को गेम पिक्सल में बदलती है, और Blender एक्सपोर्ट के लिए अक्सर 20 से 100 के मान चाहिए।
कौन सा फ़ॉर्मेट भेजना बेहतर है?
स्किल कहती है कि अकेली GLB फ़ाइल बेहतर है, क्योंकि वह एक ही अनुरोध में आती है।
क्या 3D कैमरा चाहिए?
हाँ। 3D कैमरा के बिना दृश्य सपाट दिखता है।
जानकारी
लेखक का मूल विवरण
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.
repo: melonjs/melonJS
लोकप्रियता
- GitHub स्टार
- 6.4k
- रैंकिंग में स्थान
- #14195
- लाइसेंस
- MIT
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
melonjs-20-migration
6.4kआपके एजेंट को melonJS वर्शन 20 के लिए गेम कोड लिखने में मदद करती है और पुराने वर्शन के आउटडेटेड तरीकों से बचाती है, जैसे ज़रूरी async स्टार्टअप।
melonjs-3d
6.4kआपके एजेंट को melonJS ब्राउज़र गेम में 3D या 2.5D दृश्य बनाने में मदद करती है, जिसमें कैमरा, मेश, लाइट और गहराई शामिल हैं, इंजन के अपने axis नियमों के साथ।
melonjs-audio
6.4kआपके एजेंट को melonJS गेम में साउंड इफ़ेक्ट और संगीत जोड़ने में मदद करती है, जिसमें ऑडियो सेटअप, बैकग्राउंड ट्रैक, वॉल्यूम नियंत्रण और स्थानिक ध्वनि शामिल हैं।
melonjs-camera-and-drawing
6.4kआपके एजेंट को melonJS गेम का कैमरा नियंत्रित करने में मदद करती है, जैसे खिलाड़ी का पीछा करना, और गेम के अंदर अपने आकार व लाइनें बनाना।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।