Sitemap

Creating Custom Gravity with Constant Force.

2 min readMay 16, 2025

Objective: Creating Custom Gravity with Constant Force.

Before doing this, we know from the previous article that we modify overall gravity, but now we want to modify the gravity for a single object and leave overall gravity as it is.

In the first step, select our object and add a component called Constant Force.

A constant Force is a component that will add force to an object at every frame. I will modify the force on the y-axis in play mode and see the result

Note: I will use the force parameter, but as it says, all types of force will be applied every frame.

Note: since the gravity pulls this object down by a force of 9.81, to move this object up or down, you will need to pass that number, either negative or positive

I have try to adjust the value slow but it will move it up above 9.81

To move this object in code, you need to access this component and set the value.

This is how to add custom gravity to an object.

Note: Although I press the button twice to set a value, but know this Constant force is called continuous.

see you in the next one.

--

--

Suleiman Abdullah
Suleiman Abdullah

Written by Suleiman Abdullah

Self taught Unity Developer, who is passion about making games ,and he loves Math For Game Development

No responses yet