0 votes

How to include zero gravity in a rigid body 2D?

in Engine by (42 points)

In the inspector there's the gravity_scale property which can be set to 0, or are you after a certain behaviour using gravity?

I would like the object, being in zero gravity, to move slightly.

In that case if you've got the movement you're wanting you can set gravity_scale to 0.

If you need help with the movement have a look at these methods - translate, add_force, add_central_force and applied_force in the docs.

#This will constantly accelerate upwards.

1 Answer

0 votes

All you have to do is:

func _process(delta):
    gravity_scale = 0

and there that should work.

by (50 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.