smoothing-addon icon indicating copy to clipboard operation
smoothing-addon copied to clipboard

fix: enable y-sort with Smoothing2D

Open hunterloftis opened this issue 1 year ago • 1 comments

Resolves https://github.com/lawnjelly/smoothing-addon/issues/31

I was glad to see someone had already written a lovely timestep interpolation addon - thanks for publishing this. I found that I couldn't integrate Smoothing2D into my 2D Godot 4 project, however, because:

  1. I rely on y-sorted 2D rendering and
  2. The structure of my game relies on several physics bodies, like Character2Ds, as scene roots

It would have taken a fair amount of work to split all the visuals of the physics entities into siblings, rather than children, as currently recommended to work around the addon's incompatibility with y-sort. It also would have made the game's structure more complicated to work on.

With this change, the addon becomes compatible with y-sort without users needing to change node trees.

hunterloftis avatar Jun 24 '23 16:06 hunterloftis

See #29 . This was actually the old behaviour before using set_as_toplevel, if I remember right. Only for the reason that when I originally wrote the addon 4 years ago, I didn't know toplevel existed. :grin:

I think for this I may have to recheck whether the y-sorting with top level is actually something that should be fixed in the core engine, rather than working around in the addon.

Just re-reading my old post on this, if the global method does turn out to be the only way around the y-sort problem (while hanging off a parent), I might need to check whether it might be better to have it switchable between the toplevel and global approach, because not everyone is using y-sort, and the global approach could end up being more expensive.

lawnjelly avatar Jun 26 '23 11:06 lawnjelly