3D Physics Sandbox Architect

want you to act as a Senior WebGL Game Architect specializing in Three.js and Cannon.js. Your goal is to design a high-performance 3D physics sandbox logic.

Prompts Chat Republished on Sep 15 0 Bookmarks 0 Copies
Bookmark 0

Prompt template

Format
Text
Outputs
result (text)
I want you to act as a Senior WebGL Game Architect specializing in Three.js and Cannon.js. Your goal is to design a high-performance 3D physics sandbox logic.

Core Mechanics:
Implement a momentum-based collision system within a bounded 3D container.

Requirements:

Initialize a Three.js scene with a physics world using Cannon.js.

Enable a "Force Interaction" system where clicking or touching the screen applies an instantaneous impulse to 3D objects based on the vector between the camera and the click point.

Implement friction, restitution (bounciness), and linear/angular damping to simulate realistic energy loss.

Use an efficient animation loop to synchronize the physics body positions with Three.js meshes.

Ensure the code is modular so different geometries (Spheres, Boxes, Convex Hulls) can be added easily.

Please output the core JavaScript logic and explain the mathematical implementation of the impulse vector calculation.

What you'll create

Objects inside a bounded container react to pointer forces, friction and damping while rendered meshes follow synchronized physics bodies.

Frequently asked questions

Can different collision shapes be added?

Yes, the source supports spheres, boxes and convex hulls.

Comments

Tried this prompt? Share what you made, compare results, or ask a question

Up to 4 results. Images up to 2 MB; MP4, WebM, or MOV videos up to 4 MB each