Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

var gravityScale: float;
float gravityScale;
gravityScale as float

Description

The degree to which this object is affected by gravity.

In 2D physics, the gravity is a global setting in the Physics2D class but you can also control the proportion of that gravity applied to each object individually using gravityScale. For example, it may be easier to implement a flying character by turning off its gravity rather than simulating the forces that keep it aloft.

See Also: Physics2D.gravity.