R3d.Body:setLinearDamping

From GiderosMobile

Available since: Gideros 2020.2
Class: R3d.Body

Description

Sets the rate at which the body linear velocity comes to a stop (linear damping is the body linear velocity lost per second).

r3d.Body:setLinearDamping(damping)

Damping is the effect of reducing the velocity of the rigid body during the simulation to simulate effects like air friction for instance. By default, no damping is applied.

The damping value has to be positive and a value of zero means no damping at all.

WARNINGS: setting damping a negative value will crash your app!

Parameters

damping: (number) the new body linear damping, default = 0 no damping

Example

player1.body = world:createBody(view:getMatrix())
player1.body:setLinearDamping(0.5)