World:setGravity

Edit

Sets the World's gravity. Gravity is a constant acceleration applied to all colliders. The default is (0, -9.81, 0) meters per second squared, causing colliders to fall downward.

Use Collider:setGravityScale to change gravity strength for a single collider.



Arguments

NameTypeDescription
xgnumber The x component of the gravity force.
ygnumber The y component of the gravity force.
zgnumber The z component of the gravity force.

Returns

Nothing

Arguments

NameTypeDescription
gravityVec3 The gravity force.

Returns

Nothing

Notes

Kinematic colliders ignore gravity, since they are not moved by forces. Colliders with higher mass do not fall faster.

See also