thombruce / verse

🚀 A universe in progress
Other
8 stars 0 forks source link

Decouple Planets from Parent Star #37

Closed thombruce closed 11 months ago

thombruce commented 11 months ago

The problem:

Now that I have indicators, I tried increasing the radius of the orbit for my planet. When I got to it, no planet was visible.

Why?

I suspect this is happening due to this:

If you hide an entity that has children, they will also be hidden, regardless of what their individual Visibility value is set to.

Source: https://bevy-cheatbook.github.io/features/visibility.html

But wait...

I've just tried setting NoFrustumCulling on the parent star and... it hasn't rescued the planet. It's still not showing. How sure am I that this is a parent-child issue? Not very. Surely if the parent visibility isn't culled... the child should be visible?

Checking Something...

Nope, with NoFrustumCulling added to the child as well, it still doesn't show... weird.

I believe that parent visibility is the key issue here, and that the planet does not show because the computed visibility of the star is true at a given distance with or without NoFrustumCulling.

Recommendation:

Decouple the planet from the parent star and experiment again to confirm or refute the above.

thombruce commented 11 months ago

Planet has been decoupled from the star in some recent work (not yet committed).

The indicator now appears correct. And as a bonus, the planet scaling is decoupled from the star scaling (so I can remove some adjustments I had been making).

I think two things were happening:

  1. The planet was being culled from view along with the star (but even when I removed culling from the star, I still couldn't find it because...)
  2. The indicator was pointing to where the planet would have been if not for the scaling factor tweaks (meaning the indicator was pointing at the halfway point between star and planet, rather than the planet itself)