Unity-Technologies / 2d-extras

Fun 2D Stuff that we'd like to share!
Other
1.56k stars 344 forks source link

New transform of rule tile: rotate and mirror #355

Closed samgong closed 1 year ago

samgong commented 2 years ago

I have a rule tile mixing grass and dirt on ground:

Snipaste_2022-11-25_02-45-18
3
4 ? 5
5

It works well by choosing MirrorX for horizontal grass.

However vertically, the following form does not match by choosing Rotate or MirrorXY. 4
3 ? 5
5

I know well that I could manually create a new tile sprite by flipping it and set up both rules with rotation transform to accomplish it. But it would be better to have a new transform for "rotate and mirror" to get it done with one rule and one tile sprite.

ChuanXin-Unity commented 2 years ago

Hi, I tried adding this new transform rule in: https://github.com/Unity-Technologies/2d-extras/tree/rotatedmirror

If you can, could you try it out and see if that is what you are looking for? Thanks!

samgong commented 2 years ago

For the horizontal grass that mirrored, it does not match the new rule and the default sprite is shown. original: OK

10

mirrored: not working

11

For the vertical grass, the new rule matches both cases but the sprite itself need an additional mirror transform.

13 14
ChuanXin-Unity commented 2 years ago

Hi, perhaps I don't quite understand how the Transform Rule should work for you. If you could share how your Rules work and how they look like in the inspector, that would be helpful! Thanks!

samgong commented 1 year ago
grid

The goal is to create tile 1 to 8 with rule tile. Let tile 1 be the base tile sprite, the rotation rule will generate tile 1, 3, 5, 7. the mirrorX rule will only generate tile 1 and 2. To generate all 8 tiles, currently I have to use 2 base tile, tile 1 + rotation rule to generate tile 1, 3, 5, 7 and tile 2 + rotation to generate tile 2, 4, 6, 8. Now "rotate and mirror" is a rule to generate all 8 tiles at once from tile 1.

ChuanXin-Unity commented 1 year ago

image

Sorry for the late reply! I updated the rotatedmirror branch based on the example you have given. Hopefully that matches what you need!

samgong commented 1 year ago

Thank you. It is exactly what I need!