Type Number
Object Body
Library physics.*
Revision Current Public Release (2017.3068)
Keywords body, gravityScale
See also physics.setGravity()


Use the gravityScale property to adjust the gravity on a single body. For example, setting it to 0 makes the body float (no gravity). The default value is 1.0 which means the body will behave under the normal simulated gravity.



-- Create a rectangle
local myRect = display.newRect( 0, 0, 100, 100 )

-- Add a body to the rectangle
physics.addBody( myRect, "dynamic" )

-- Set gravity scale
myRect.gravityScale = 0.25