Legacy Documentation: Version 4.6(go to latest)
Language: English
  • C#
  • JS
  • Boo

Script language

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

Rigidbody2D.gravityScale

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public var gravityScale: float;
public float gravityScale;
public 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.