Physics basics: Controlling collisions with restitution

Edited

We can control the elasticity of collisions in Tynker by changing the actor’s restitution. Consider the different behavior of these three hockey pucks.

Each puck has the same starting impulse, but their restitution is different, so they behave differently after a collision:

hockey-bounce.gif

Restitution is a measurement of an actor’s bounciness. It’s typically a value between 0 and 1. This measurement is best understood as the coefficient of restitution, which describes the ratio between the objects’ velocities before and after the collision. Set it higher to be more bouncy!

In Tynker, you can break the laws of nature in your physics simulation! Watch what happens when you give objects a restitution over 1. This group of penguins has a restitution of 2, and things quickly get out of hand!

hyper.gif

With each collision, the actors speed up. (This isn’t possible in the real world.)

You can even use physics collisions as events. Did you notice how the penguins changed costumes each time they collided? Here’s the code that did it:

Sample Projects

You can see the Hockey Rink project here.