Compound Shapes
Working Example
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.
Useful Links
Trimeshes, ConvexPolyhedrons and Compound Shapes | sbcode.net |