appsinacup / godot-box2d

Godot Box2D – C++ Godot Extension that integrates the Box2D physics engine.
MIT License
329 stars 15 forks source link

Incorrect behavior when implementing 2D planet attractors using Area2D nodes #83

Open SirLich opened 11 months ago

SirLich commented 11 months ago

Describe the bug In Godot, it's possible to use Area2D nodes, to define custom gravity settings. Example, using Godot Physics:

image

The large planet is a static body, with a gravity well defined thusly:

image

image

The smaller planets are RigidBody2D, and stick to the larger planet. Here are my physics settings:

image

When using Box2D, the following behaviors are observed:

image

Changing the default physics settings (e.g., setting anti gravity), doesn't appear to fix the problem.

To Reproduce Steps to reproduce the behavior: I will provide a test

Expected behavior A clear and concise description of what you expected to happen.

Project I will add one later! Sorry.

Versions (please complete the following information):

SirLich commented 11 months ago

@Ughuuu here is the project: area2dgravity.zip

It's all setup for you to play! Just press f5.

What you should see:

image

Once you've confirmed it's working, change the physics server to Box2D, and observe the chaos!

Ughuuu commented 11 months ago

It is a bit strange indeed. Will need to investigate it.