Working with restitution and friction
In the next example, we’ll look a bit closer at the restitution
and friction
properties of the Collider
provided by Rapier.
restitution
is the property that defines how much energy an object keeps after it collides with another object. You can look at it a bit like bounciness. A tennis ball has high restitution, while a brick has low restitution.
friction
defines how easily an object glides on top of another object. Objects with high friction slow down quickly when moving on top of another object, while objects with low friction can easily glide. Something such as ice has low friction, while sandpaper has high friction.
We can set these properties during the construction of the RAPIER.ColliderDesc
object or set it afterward when we’ve already created the collider using the (world.createCollider(...)
function. Before we look at the code, we’ll have a look at the example. For the colliders-properties.html
example, you...