So as you can see here in the video, halfway through the screen, the bullets change “layer”. Undoubtably caused by some sort of ray-tracing, as it assumes the middle sprite is closer to the screen than the ones further away from the center, but are any of you aware of a way to prevent this from happening?
Have you tried to spawn them on a slightly different height to prevent them from “z fighting”?
I could, but keep in mind this is the kinda game where thousands of bullets will spawn during the level, and that solution doesn’t seem sustainable for that, unless I use orthographic camera. Either way, do you have a good solution for how to make sure each bullet spawns a “layer” higher than the previous?
I was thinking about finding some way to track amount of bullets spawned and making that into the bullets translucency sort priority, that way if there have been 150 bullets, the 150th bullet would have priority 150, thus be over all bullets with a lower priority, but I can’t find a way to keep track of how many bullets there are. I’m thinking about it, but I’m not sure if I can call the translucency sort to change it either. Hmm.
Okay so I tried that out, and at first I thought it worked, but then I realized that as the old bullets die off, the priority would be lower. If I can find a way to keep track of all the bullets spawned total and call that when a bullet is spawned, this would be fixed.
New video https://puu.sh/tpE2Z/de579dc687.mp4
I guess that’ll work for now, but what if I want to have bullets coming from behind? Do I need to make a new bullet type for those and sort it the opposite way? What if I want a bullet pattern where the bullets spin around the player?
So I took some of the advice posted here and did my own tweak on it. I ended up making a variable in the game mode blueprint, made it an integer and caused it so that when a bullet spawns, it calls the game mode blueprint and sets the integer to +1, then it makes this integer its translucency sort priority, so it’ll always spawn on top of any other bullet spawned. Thanks for making me think of this!
Here’s what the bullet blueprint looks like:
And here’s a video of it working