I am trying to sort Sprites in the -Y axis using Sort by Axis. It works well with same-sized sprites, but poorly with sprites of different sizes. It appears the sprites are being sorted by their center points. I need to sort them by their bottoms. Is there a way to do this?
Okay, I figured it out. It’s the Scene Root that determines where an object lies on a given axis. So by moving the sprite/flipbook so that the Root sits at the bottom, and by checking Use Attached Parent’s Bounds, I am able to sort my sprites correctly without having to set the Sort Priority on Tick in Blueprint.
But with the solution you found I have another problem: whenever a root component location goes outside my camera view, the sprite attached to it suddenly disappears. I hope there’s another solution, since I should be able to spawn sprite and see them in the correct sorting order.
It seems sorting ALWAYS uses the center of the sprite, even with small ones. In your video it worked with the smaller ones because they were the same, I think, so they had the same center. I think I’ve read somewhere it should use pivot points, but that doesn’t seem to work.
You’re right. Soon as the root goes off screen the sprite disappears. Maybe there’s a way to fix that. I did get the sorting to use the bottom of the sprite though, look: - YouTube
edit:
So I found no solution to vanishing sprites. You can’t use Attached Parent’s Bounds without that happening. It seems right now the only way to sort sprites is to set the Translucency Sorting Policy in blueprint.
Just make the parent BIGGER, so the sprite is completely inside of it.
For those using Paper2D, of course making the collision capsule (the component the sprite is attached to) bigger would work, but it would screw up all collisions.
So just create another component(I’m using a USphereComponent), attach the sprite to that and adjust the dimensions of the component as I said before.
Everything seems to work perfectly now.
You managed to get it to work without screwing up collisions? I thought only the root component was moved and everything else attached was teleported, necessitating making the collision component the root in order to block movement.
I’m not sure, but I don’t think it works like that.
Either way, that’s not the point, because you don’t have to use the bounds of the root component. You can attach another component (like my sphere) to the root and attach the sprite or flipbook to that component, so you can use the bounds of that one instead of the root.
This way you are free to use the root as you see fit (like a capsule component for collisions) and you only need to adjust the size of the other component, parent to the sprite, in order to make it so it contains the sprite itself.
AGAIN, this is MY solution, but I guess there are better ones out there.
You can see where I split it. I left the gap there so I can make sure it is split according to view. I have the front ring lets say at 7 the body at 8 the back rings at 10. The rings still look like this