Compound Shapes
Description
You can simulate more sophisticated cannon body shapes by utilizing the useCompoundBody
hook to create a compound shape.
A compound shape is a collection of shapes. If you need a shape that is more complicated than a sphere, box or cylinder, then you will get much better performance by creating a compound shape of spheres, rather than using a trimesh, convexPolyhedron or a compound shape of other shapes.
Change the visibility of the Debug Renderer in the working example above to visualize the compound shapes used. Walk around the scene and see the effect when you collide the character with the spinning objects.
Working Example
Useful Links
Follow Cam Example 1 | FollowCam |
Follow Cam Example 3 | Obstacle Course |
Trimeshes, ConvexPolyhedrons and Compound Shapes | sbcode.net |
GitHub Branch
git clone https://github.com/Sean-Bradley/React-Three-Fiber-Boilerplate.git
cd React-Three-Fiber-Boilerplate
git checkout cannonCompounds
npm install
npm start