Physic state gets calculated late.

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

Hey!

I’m trying to create a turn-based roguelike game(room based). I have a bug which i could not solve for days.

My game is procedurally generated. On my _ready function I do the procedural generation and then call update_visuals method as call_deferred, which deletes fog from the map using ray casting. (By default fog is everywhere)

When I don’t use procedural generation and generate the map with hand, my update_visuals works perfect. But with procedural generation I could only make it work by putting a wait. (The bug also occurs if I pass through a Door while I play)

If I don’t put a wait, then left side of the map gets calculated wrong, while right side gets calculated true.

It seems like my direct space state does not get updated, even if I use call_deferred()

I tried a lot of different approaches, but the only fix was wait.

Thank for your attention,
mudiko