Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pivot points and sorting issues #179

Open
FerdyHoefakker opened this issue Apr 14, 2021 · 5 comments
Open

Pivot points and sorting issues #179

FerdyHoefakker opened this issue Apr 14, 2021 · 5 comments

Comments

@FerdyHoefakker
Copy link

Hi,

Not sure if this is an issue, or me not understanding something correctly. I'm currently messing around with an isometric view. The Unity default tilemapping left much to be desired due to the inability to (easily) paint prefabs. So I was looking for a better solution. Tiled + SuperTiled2Unity seemed pretty nice (and it was all free too! Perfect for just messing around and experimenting). Tiled offers a nice way of making maps and (theoretically) importing the result in Unity should be a snap.

However, I just can't seem to get the sprite sorting correct. I understand my character would traverse the Sort Order based on the 'elevation' level they are at, so objects on a lower elevation will appear behind the character sprite. It's objects on the same level that are giving me a headache though.

From what I've been reading, this is supposed to be handled through the Custom Sorting Axis and the Pivot Points of the sprites. So, I exported my test map, imported it in Unity, sliced the tilesheet and set the Pivot Point for one of the sprites of the map.
pivotpoint

However, it seems like ST2U creates a copy of the tilesheet and uses that to create new sprites. The objects it creates all have their Pivot Points set to the absolute bottom left, resulting in incorrect sorting.

behind
Here the character is correctly placed behind the environment. If I move it slightly down however, the character is in front of the environment as seen below.
notbehind

I want the character to start appearing in front at about this point, based on the Pivot Point:
expected

If I drag the sprite directly from my tileset onto the scene, it works as expected:
isolatedPrefab

I tried creating a custom importer to add a new object onto the scene for each tile and just hide the ones made by ST2U, but I'm having trouble accessing the actual tilesheet asset. And even if I could, I can't easily grab the actual sprite, since ST2U counts empty spaces when slicing, so the names and indexes for the sprites used by ST2U do not match up with my sliced asset.

Chances are, I'm overlooking something, or doing something wrong, but it's driving me nuts so any help would be appreciated :)

-Ferdy

@clonzeh
Copy link

clonzeh commented Jun 17, 2022

Any updates on this? Pretty frustrating that it's ignoring pivot points. Kinda wondering why in the world it would be this way since tile sizes and character sizes can vary greatly...

@FerdyHoefakker
Copy link
Author

Unfortunately no. I was working on dozens of little projects at the time just to see if I could do it. So non of them were really serious projects and thus abandoned when running into too much hardship :P

-Ferdy

@clonzeh
Copy link

clonzeh commented Jun 17, 2022

Messing with the z custom sort and sprites z pos seems to help somewhat

@ZhengSSQuan
Copy link

Transparency Sory Axis的(x,y,z)的y/z = 图片大小的宽/高,能完美解决等距地图的这个遮挡问题。
实际上仔细思考是个数学问题,但是我是胡乱填数据测试发现似乎有效,然后研究出来的

@ZhengSSQuan
Copy link

或者只是一个巨大的Transparency Sory Axis的z?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants