You are here: Lua Scripting Resources eGuide > Lua Scripting API Reference Guide > Physics Library > setRestitution

19.5.16 setRestitution

self = physics.Shape:setRestitution(r)

Parameter

Type

Description

self

in physics.Shape

The input Shape

r

in number

The new value for the shape’s restitution

self

out physics.Shape

The input Shape is returned as the output

Sets the restitution (or elasticity) of the shape. A value of 0.0 gives no bounce and a value of 1.0 gives a perfect bounce. Returns self.

Note

May not behave as expected for r larger than 1.0 or less than 0.

Introduced in platform.apiLevel = '2.0'