How do I make Area2D ignore its parent?

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

I have an ‘Asteroid(RigidBody2D)’ with a ‘Gravity(Area2D)’ child node. I want the Gravity to affect other asteroids, but not its own parent.

:bust_in_silhouette: Reply From: picnic

Setting the RigidBody2D’s gravity scale to negate the area2d’s gravity might work but you may need to re-order the scene tree. From help:

float gravity_scale
set_gravity_scale(value) setter
get_gravity_scale() getter
Multiplies the gravity applied to the body. The body’s gravity is calculated from the “Default Gravity” value in “Project > Project Settings > Physics > 2d” and/or any additional gravity vector applied by Area2Ds. Default value: 1.