PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Jul 03 2018, 10:01 AM PST 2 min

Gravity is the phenomenon which applies a constant downwards force in Roblox, causing objects to fall.

How does gravity work?

In the real world, gravity (gravitational acceleration to be specific) is caused by spacetime distortions. These spacetime distortions are created by everything in the universe that has mass. Objects with a large mass cause a large spacetime distortion, causing a strong gravitational field. This allows the Earth to orbit around the Sun, the Moon around the Earth, and let Neil Armstrong walk on the Moon.

Since the force due to gravity is proportional to the mass of the object it is being applied to, Earth’s gravity induces a constant acceleration in all objects, irrespective of mass The Earth’s gravitational acceleration is roughly 9.81 m/s2 (meters per second squared) but varies slightly with altitude.

Gravity in Roblox

In Roblox, there is no spacetime distortions, or no celestial bodies to create gravitational acceleration. Gravity will always pull down in Roblox, and does so with a gravitational acceleration of 196.2 st/s2 (studs per second squared). Assuming the Roblox world’s gravity is as strong as Earth’s gravity, this suggests that one stud is 5 cm, since 196.2 st/s2 × 0.05m/st = 9.81m/s2.

Changing the strength of gravity

The Workspace/Gravity property on Workspace allows developers to change the gravity for all objects in their game. This property changes the acceleration due to gravity in studs/sec^2, the default value is 196.2.

It is also possible to change the effective gravitational pull on individual parts by providing additional acceleration in the opposite direction to gravitational acceleration. The code below will negate the default gravity of Roblox for the part, and cause it to stay in the air with no forces working upon it.

Gravity-Snip.png

Specifically, the code sets the force in the BodyForce to the negative of the gravitational acceleration in Roblox and multiplies that by the mass of the object.

It is important to note that gravity in Roblox is an acceleration, a BodyForce object is a force, and that the BodyForce’s force needs to be multiplied by the mass of the object in order to equal the gravitational pull on the object.

See Also

  • BodyMover
Tags:
  • physics
  • gameplay