# Why my object is falling ??

4.2.2

### Question

Hello!
I’m creating different obstacles for my game and I have a problem with the rocks which (unlike the other objects) are falling : they go down until they disappear but not at the speed chosen in the code, also the speed seems to increase exponentially.
The other obsatcles are moving down normaly.
However I had the same problem for an other obstacle (arbuste) but the problem disappeared I dont know how.
I also put the gravity at 0 (the problem is still here with gravity at -1)
And rock = rocher (in french).
Do someone have an idea to solve the problem ?
Thx.

The body’s gravity is calculated from the Default Gravity value in Project > Project Settings > Physics > 2d. You could turn that off, eventhough if it is set to 0 it shouldnt apply also

1 Like

You are using the RigidBody2D for the obstacle, which is a node that is influenced by forces.
If you are concerned about the obstacle accelerating, I recommend to not use a node that is influenced by forces, and use a regular Sprite2D for the obstacle.
When animating the motion of the sprite, I’d use linear interpolation.
With linear interpolation you don’t need to worry about physics, There will be no acceleration.
Here’s an example of a simple script to attach to a sprite for such motion:

``````extends Sprite2D

#pixels per second
var velocity = 5
var length = 50

var start_position = self.position
var end_position = Vector2(self.position.x,self.position.y + length)

# Called when the node enters the scene tree for the first time.
pass # Replace with function body.

var t = 0
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
t += delta
#check if t<1, if sprite finished trajectory.
if(t < 1):
interpolation(t)

func interpolation(t):
self.position = self.start_position.lerp(self.end_position,t*self.velocity)

``````

Here are the Godot documents explaining linear interpolation:

1 Like

Interesting… I put the gravity value at 0 in the prject settings and the rocks went upwards but with gravity at 30