Closed AndrewRayCode closed 8 years ago
You're right, this should definitely be documented and brought more into the light. Thanks for the heads up.
If you look closer you see that Cannon.js has support for both per-body and per-shape materials. The reason why I added per-shape materials to Cannon is that I wanted to enable workflows like in Unity, where you specify friction and restitution per Collider Component. And also because Box2d has it. I believe per-shape is the way to go, because per-body is more limiting.
Turns out it was already documented. However, I made the demos use the constructor option. Much cleaner. Thanks.
According to the source code, you can pass in a material to the constructor of a shape.
However this isn't mentioned in the shape documentation.
Also the friction demo doesn't take advantage of the
material
in theShape
constructor:Additionally, why did you choose to put the material on the shape instead of the body (like Cannon does it?)