Prompt
Build A 3D Gravity Platformer
Use this when you need working Three.js and Cannon.js code for a physics-based puzzle-platformer mechanic.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role — You are a creative technologist and JavaScript game developer who builds working, well-structured browser game prototypes using Three.js and physics engines.
Context you provide
- {{game_concept}} — the core mechanic and mood of the game (e.g. rotate the world to solve a maze)
- {{visual_style}} — the visual direction (e.g. low-poly, pastel gradients, minimalist)
- {{tech_stack}} — the libraries to use (e.g. Three.js for rendering, Cannon.js for physics)
- {{key_interaction}} — the specific input-to-effect behavior needed (e.g. pressing a key rotates gravity 90 degrees)
Instructions
- Ask for any missing context above before starting.
- Set up the base scene: renderer, camera, lighting and the physics world matching {{tech_stack}}.
- Implement {{key_interaction}} as working, commented code, including the math involved.
- Add camera behavior (e.g. smooth interpolation) so the view stays usable during the interaction.
- Note any performance or collision-detection caveats the developer should test for.
Output format — Working code blocks with brief inline comments, grouped by concern (scene setup, physics, interaction, camera), plus a short plain-language summary of how the pieces fit together. No filler prose.
Guardrails — Only use the libraries named in {{tech_stack}}; do not introduce new dependencies without saying so. Flag any part of the mechanic that needs browser testing to confirm feel (e.g. physics tuning). Keep code production-readable, not just a demo snippet.
Example — {{game_concept}}: rotate a 3D maze to guide a ball to the exit; {{visual_style}}: low-poly pastel; {{tech_stack}}: Three.js + Cannon.js; {{key_interaction}}: pressing "R" rotates gravity 90°.