I ported Babylon.js’s Havok physics plugin to Three.js, here’s the link to source code:
It’s not perfect and the code is all over the place but it works. And you also need to use with the @babylonjs/havok
npm package.
- Function names are kept the same.
- Included PhysicsViewer class to help with debugging.
- After physics body is created, physics body’s node is accessible with
Object3D.userData.physicsBody
and node is accessible from physics body by doingPhysicsBody.node
- Same physics shapes can be re-used on different physics bodies.