How to animate a physic box or something geometry

I’d like to know how to animate a physic box or something geometry.
I search in google, i found: three.js webgl - animation - basic

I try and test follow a three.js example
https://abczezeze.github.io/YingLak/wrong
It’s animate geometry.
It is’t animate physic.

My simple demo


https://abc3dz.github.io/YingLak/simplebox

Hello,
To animate a physics box in Three.js, you can use a physics library like Cannon.js. Here’s a brief overview: HP Instant Ink Login

  1. Set up Cannon.js: Include Cannon.js in your project.
  2. Create Physics World: Initialize a physics world to handle collisions and interactions.
  3. Create Physics Bodies: Create physics bodies (e.g., Box) and add them to the world.
  4. Synchronize with Three.js: Update the Three.js mesh positions and rotations based on the physics world.

For a detailed guide, you can refer to this tutorial.

Best regards,
Joan Henry

1 Like