Skip to main content
Prompts Three.js Gravity-Rotating 3D Platformer Builder

developer coding user risk: low

Three.js Gravity-Rotating 3D Platformer Builder

Build a 3D platformer using Three.js and Cannon.js with a cube-shaped maze where pressing 'R' rotates the world gravity vector by 90 degrees. Include the specified JavaScript gravi…

PROMPT

Game Concept: A puzzle-platformer named "Gravity Shift" where players rotate the entire world to navigate a 3D low-poly labyrinth. The environment is minimalist, using pastel gradients and sharp geometric shapes.
Technical Prompt:
Build a 3D platformer using Three.js and Cannon.js. The world is a cube-shaped maze. When the user presses 'R', rotate the world.gravity vector by 90 degrees.

JavaScript
// Gravity rotation logic
world.gravity.set(0, -9.82, 0); // Default
function rotateGravity() {
  let newG = new CANNON.Vec3(-world.gravity.y, world.gravity.x, 0);
  world.gravity.copy(newG);
}
Include smooth camera interpolation using Lerp to follow the player's rigid body during shifts.

REQUIRED CONTEXT

  • game concept description
  • technical prompt with partial JavaScript code

EXPECTED OUTPUT

Format
code
Constraints
  • valid JavaScript
  • include Three.js and Cannon.js
  • gravity rotation logic
  • smooth camera interpolation

SUCCESS CRITERIA

  • Build a 3D platformer using Three.js and Cannon.js.
  • Create a cube-shaped maze world.
  • Rotate world gravity vector by 90 degrees on 'R' key press.
  • Include smooth camera interpolation using Lerp to follow player during shifts.

FAILURE MODES

  • May not incorporate provided gravity rotation code.
  • Might omit key press handling for 'R'.
  • Could neglect minimalist low-poly aesthetic with pastel gradients.
  • May lack proper physics integration with Cannon.js.

EXAMPLES

Includes one JavaScript code snippet for gravity rotation logic.

CAVEATS

Missing context
  • Full input controls (movement, jumping).
  • Three.js scene, renderer, camera initial setup.
  • Cannon.js world initialization code.
  • Maze geometry or procedural generation details.
  • Player model and rigid body setup.
  • Rendering and animation loop structure.
Ambiguities
  • Undefined maze structure: 'cube-shaped maze' lacks specifics.
  • Player controls not specified beyond 'R' key.
  • Camera lerp details vague: 'follow the player's rigid body during shifts.'
  • Assumes 'world' Cannon.js world object exists without setup instructions.

QUALITY

OVERALL
0.55
CLARITY
0.75
SPECIFICITY
0.65
REUSABILITY
0.30
COMPLETENESS
0.45

IMPROVEMENT SUGGESTIONS

  • Provide a complete boilerplate template for Three.js + Cannon.js 3D platformer.
  • Specify all player controls, e.g., 'WASD' for movement, 'space' for jump.
  • Include example maze geometry using Three.js meshes or boxes.
  • Detail camera lerp implementation with target position, velocity, and smoothing parameters.
  • Add code snippets for low-poly styling, pastel shaders, and geometric shapes.

USAGE

Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.

MORE FOR DEVELOPER