![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | danii956 |
More specifically, is there a way to get properties of colliding RigidBody2D through the lens of the collided RigidBody2D?
One solution that will not work is using body_entered(body) signals. There will be multiple instances of colliding RigidBody2D objects (Planets) that will collide against the collided object (Player) and does not make sense for multiple colliding RigidBody2D objects (Planets) to emit their properties to the collided object (Player).
There is also the issue that it is awkward for collied RigidBody2D object (Player) to expose properties using signals when there are multiple instances of the colliding RigidBody2D. For example, I may want to make the Player object send his properties to a single Planet object instead of all instances of the Planet object. However, with connecting signals through code, it will ensure that all instances of the Planet object will get the signal since it will share the same script.
All these problems should be solved if there is a way to get the properties of colliding objects through the collided object but RigidBody2D’s body_entered(body) does not fire when the signal is emitted to itself unlike Area2D’s body_entered(body). Any work around for this is greatly appreciated. Thank you.