2D Toolkit Forum

2D Toolkit => Support => Topic started by: firmie on October 28, 2013, 01:10:03 am

Title: Tilemap layer Z Offset Issue
Post by: firmie on October 28, 2013, 01:10:03 am
Seems the z offsets of the layers in my tile map are inconsistent.

I have 5 layers, all of their offsets are set to 0.1, except layer 0, which defaults to 0 as the base. I assume this means the offsets are supposed to stack. Meaning layer 5 will end up at 0.4 z offset.

This doesn’t seem to work properly as some of my tiles in higher layers end up with a lower z than the lower layers. Lots of times their z is just plain 0 while a lower layer may correctly be, say, 0.2.

It seems inconsistent within the layers as well, as some of the prefabs end up at a different z than other prefabs in the same layer.

Details:
* All of my tiles are being replaced with prefabs, whose local z positions are all set to 0.

* My camera is in the negative z looking down the positive z axis, and the tile offsets are actually supposed to increase in the negative z direction to become closer to the camera and be on top. Not sure how this is handled as I can’t set negative values for offsets. But most of my layers seem to handle this fine, as they are properly set to negative values.

I'm Using 2.2.
Title: Re: Tilemap layer Z Offset Issue
Post by: unikronsoftware on October 28, 2013, 12:04:24 pm
Is there a relative offset on these prefabs, vs the Layer gameObject vs the Chunk game object its hosted in? The layer game objects offset should be correct.

In your prefab set up do you have "Enable Prefab Offset" ticked?
Title: Re: Tilemap layer Z Offset Issue
Post by: firmie on October 28, 2013, 05:28:59 pm
Ugh, this one is on me. Apologies.

I have some z bumping in my code through a base class. The layer object offsets are indeed correct. I was bumping certain objects another 0.1 in the z direction to get them slightly on top of other objects in the same layer.

Thanks for your time.