Skip to content
This repository has been archived by the owner on Jun 29, 2024. It is now read-only.

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

Open
SirLich opened this issue Dec 8, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@SirLich
Copy link

SirLich commented Dec 8, 2023

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:

  • Originally, gravity well functions
  • After a few seconds, the balls start to roll down even though they shouldn't!!
  • Eventually they go flying off the planet with extreme speed

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):

  • OS: Windows
  • Godot: 4.2
  • Box2d: Custom version you sent me. Version.txt says 'v0.9.4', but I don't know if that's correct.
@SirLich SirLich added the bug Something isn't working label Dec 8, 2023
@SirLich
Copy link
Author

SirLich commented Dec 8, 2023

@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
Copy link
Collaborator

Ughuuu commented Dec 8, 2023

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants