Phaser API Documentation

  Version: 
setDamping(value)

Description:

If this Body is using drag for deceleration this function controls how the drag is applied. If set to true drag will use a damping effect rather than a linear approach. If you are creating a game where the Body moves freely at any angle (i.e. like the way the ship moves in the game Asteroids) then you will get a far smoother and more visually correct deceleration by using damping, avoiding the axis-drift that is prone with linear deceleration.

If you enable this property then you should use far smaller drag values than with linear, as they are used as a multiplier on the velocity. Values such as 0.95 will give a nice slow deceleration, where-as smaller values, such as 0.5 will stop an object almost immediately.

Parameters:

name type description
value boolean

true to use damping for deceleration, or false to use linear deceleration.

Returns:
Description:

This Game Object.

Since: 3.10.0