So here is the scenario.
I have a space sim, and I'll have several overlapping Area2D:
- The Sun's sphere of influence (SOI)
- A planet's SOI
- A planet's Atmosphere
I will have many objects that can interact with these gravity fields, but I want them to be able to do some orbital calculations as well.
In order to do these calculations I need to know the objects position, the objects velocity relative to the area2d centroid, and the gravity present in the area2d as well as the gravitydistancescale.
I also need to be able to tell if the area is an Atmosphere or a gravity well.
I need to do this in priority order.
So the trick is, I need the bodies to track the area2d they are inside.
The signals that Area2D provides aren't enough. I can get body_entered but this does not pass the Area2D to the body for me to keep track of. It also doesn't give me the first Area2d I start in onready.
Any advice for listing objects of a certain type in the scene or some other way to do this?