Fixture:setRestitution

Available since LÖVE 0.8.0
This method is not supported in earlier versions.

Sets the restitution of the fixture. Range: [0.0, 1.0]

Restitution determines how much a body bounces after a collision. The value should be greater than zero and is usually in [0, 1].

You can think of restitution as a scale on the reflected velocity after a collision. A bouncy ball would have a high restitution (an elastic collision keeps most of the velocity) and a brick a low restitution (inelastic collision loses most of the velocity). A value of one would be perfectly elastic and maintain all of its velocity.

For more detail, see how Box2D's ContactSolver uses restitution to scale the velocityBias and how it preserves the higher restitution of two bodies to bias towards bounciness.


Function

Synopsis

Fixture:setRestitution( restitution )

Arguments

number restitution
The fixture restitution.

Returns

Nothing.

See Also


Other Languages