Working with top-down 2D physics (a couple of questions)

Godot Version

4.2.1

Question

Hello everybody.

I have experience with other 2D game engines, but I’ve never tried Godot, so as a first project i’m trying to build a 2D minigolf but i’m having a problem with the physics: normally the 2D physics is designed for side view games, so there’s gravity, but in my case i can’t have any gravity force, beacuse it would move the balls towards the bottom, so i tried to set the gravity to 0 (both for each Node and as a Project-wide setting), but this breaks completely the engine (I can’t apply the correct force).

So I wanted to ask:

How to use the 2D physics engine in a top-view game?

How to "link" together a `Sprite2D`, `RigidBody2D` (child of Sprite) and `CollisionShape2D` (child of RigidBody)?

I read online about the Box2d plugin; is it worth to use that instead of the default 2D physics engine?

Thanks in advance, and sorry for the number of questions.

1 Like

Hi,

You should create a new scene, the root node as RigidBody2d, and Sprite2d and CollisionShape2D as children of RigidBody2d.

For the gravity, i’m unsure how to do it. But you can try to use a property from RigidBody2d gravity_scale and set to zero.

2 Likes

Thanks for the answer about Nodes.

Unfortunetly, i’ve already tried setting 0 gravity, both using gravity_scale and using the Project’s settings, but it didn’t work (there was no gravity, but i couldnt apply any force to the Body).

1 Like

It seems correct to set gravity to 0. So, can you show us code of how are you applying the forces?

1 Like