Render on top new created 3D labels for popup numbers

Godot Version

4.3.stable

Question

Hello, as you can see in the video (sorry for the poor quality) I am instanciating some Label3D scenes to show the damage dealt in time (and queuing them free as soon as the animation finishes). In some cases a lot of numbers pop up in a short amount of time, and they overlap.
The problem is that the last created numbers are behind, but I would like the new ones to appear on top.
I tried to move the number scene as a child 0 as soon as it is added to te tree, but it is not working. I think the problem is the render priority, but it would be difficult to keep track of it for every number created, especially because in some cases the frequency is really high.
Any suggestion?

Hi.
Rendering order is top to bottom. So the latest drawn is in front (the last in the scene tree). Make sure that “y_sort_enabled” on the numbers and the parent in’s enabled.
If you think you have done this already you should check if its realy is ( print_tree_pretty may help Node — Godot Engine (stable) documentation in English )

1 Like

Just checked with your suggestion using print_tree_pretty, and can confirm the labels are being added to the tree correctly, the newer ones are added on the bottom as you can see here in the screenshot, the last 3 alements are the labels, from oldest to newest.

Also, it is not possible to y_sort, because this is a 3d environment and Label3D is not a CanvasItem.
So it is still not working…

Tree order does not impact 3D rendering. You need to change the Render Priority property on recently created Label3Ds or use the Sorting Offset property.

Alternatively, you could modify existing Label3Ds and increment their number if a damage event has occurred shortly after the creation of a Label3D (e.g. within a 0.4s time frame). A lot of games do this to make damage numbers more human-readable.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.