I was needed to sort some game objects by position on the screen. There are a lot of sorting algorithms , and simplest one is the Bubble Sort algorithm. It works fine for me because I have the small count of objects to sort. There is the code example in GDScript that sorts simple array of numbers:
Desired beam: Try 1. Must be something like this. But it doesn't work Try 2: 1. Fix a shader. Connect it to UV. 2. Use 2 crossed cubes with Z scale equal 0.00001. 3. Apply shader to those cubes Try 3. 1. Replace TextUniform to ColorRamp 2. Remove ColorRamp from Diffuse socket Now it looks great!