Problem with Area2D Gravity and Project Gravity

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MaxwellDexter

Hi there,

I’ve got this area shape that is acting as a magnet for pickups, and I want everything inside the area to be ‘magnetised’ to the centre. I have an Area2D on the player with its own gravity turned on, and I have the global gravity scale set to 0.

The Area2D (the big circle) correctly applies gravity when the game starts to run, but then the gravity only kicks in when the pickups are really close (??). There is no gravity_distance_scale set on the Area2D.
Please take a look at the gif

They should be zooming towards the middle as soon as they’re inside the Area2D right?

The Area2D on the player looks like this:
And the Pickup Rigidbody2D looks like this:

The local gravity of the Area2D works just fine when there is no change to the project settings.
I’ve also tried a workaround that leaves the project settings at default and sets the gravity scale to something > 0 on body enter, but it strangely has the same problem. Is this an issue with the updating of physics bodies or something?


Can you provide an example project?

njamster | 2020-04-15 13:57

Yes indeed!
GitHub - MaxwellDexter/Zen-Skimmer

Thank you :))

MaxwellDexter | 2020-04-16 12:03

It’s most likely something to do with how the engine ‘wakes up’ objects that weren’t being affected by gravity, since once the objects are moving with velocity, the area2D acts just fine.
I can’t figure it out ¯\_(ツ)_/¯

MaxwellDexter | 2020-05-05 06:02

I can’t figure it out

Sadly I couldn’t either, sorry :frowning: Consider opening up an issue over at github.

njamster | 2020-05-11 14:15