Hello Guest

Author Topic: Tile Map Rotate 90 Issue - Prefab Does Not Rotate  (Read 6753 times)

fierceblaze

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Tile Map Rotate 90 Issue - Prefab Does Not Rotate
« on: September 19, 2013, 02:34:15 am »
Tile Map Rotate 90 Issue

I did not find this on the forum yet so I thought I would mention this here. I am sure that is because this is not the proper place for bug reporting so I am sorry if I am out of place here.

Prefab data is NOT rotated 90 degrees with the tile on the map. On commit it shown in it's original un-rotated state. It is very easy to simply go into the "Tilemap Render Data" and edit it after commit. I am sure, however, that it something that was unintentionally overlooked and will be fixed in the next hotfix.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tile Map Rotate 90 Issue - Prefab Does Not Rotate
« Reply #1 on: September 19, 2013, 10:56:11 am »
What version of tk2d are you using here? I'm pretty sure this behaviour was changed at some point.

fierceblaze

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Tile Map Rotate 90 Issue - Prefab Does Not Rotate
« Reply #2 on: September 19, 2013, 09:22:17 pm »
2.2 Final.

A tile can now be rotated... Yay!!! Been waiting for that!!!
The prefab associated to it by way of the data panel... Not automatically rotated with it...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tile Map Rotate 90 Issue - Prefab Does Not Rotate
« Reply #3 on: September 20, 2013, 12:12:56 am »
Can you send a repro project of this issue to support at unikronsoftware.com, please. I think it is applying the transform twice, but its hard to tell without seeing how you've configured it.

fierceblaze

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Tile Map Rotate 90 Issue - Prefab Does Not Rotate
« Reply #4 on: September 20, 2013, 01:35:42 am »
I think it's not applying anything at all.
It's not an error it looks like an oversight.
It's not doing what I expect it to do.

Sometimes you have to see the issue so I reproduced it on an unlisted video on youtube...
http://www.youtube.com/watch?v=wBmReKFWBjk&feature=youtube_gdata

You can get the project files here... (2D Toolkit folder was removed to avoid piracy.)
https://mega.co.nz/#!QEhVyLJL!Dh5ltz7PpdmyvGNnO81YZX1YNKBN32H-8l7HPDAXRCw
« Last Edit: September 21, 2013, 06:11:55 pm by fierceblaze »

fierceblaze

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Tile Map Rotate 90 Issue - Prefab Does Not Rotate
« Reply #5 on: September 21, 2013, 06:09:05 pm »
Hey, any update on this, guys?

One of my games should be nearing completion very soon thanks to 2D Toolkit.
The new UI and tile map features allowed me to cut development time into weeks instead of months.
But level creation will be a huge pain in the butt without that fix.

What are your thoughts on the issue?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tile Map Rotate 90 Issue - Prefab Does Not Rotate
« Reply #6 on: September 22, 2013, 12:10:33 pm »
Yup, thanks for the repro case. Just remembered why we didn't implement it on prefabs - it was mainly to do with scaling and not rotation. Scaling a gameobject will result in the localScale being non uniform, and Unity doesn't like to batch non-uniform meshes.

Anyway, if you'd like to enable the lines in bold to tk2dTileMapBuilderUtil.cs


                     instance.transform.parent = parent;
                     instance.transform.localPosition = pos;

                     int rawTile = chunkData[y * tileMap.partitionSizeX + x];
                     Vector3 scale = prefabGameObject.transform.localScale;
                     if (BuilderUtil.IsRawTileFlagSet(rawTile, tk2dTileFlags.FlipX)) scale.x = scale.x * -1;
                     if (BuilderUtil.IsRawTileFlagSet(rawTile, tk2dTileFlags.FlipY)) scale.y = scale.y * -1;
                     instance.transform.localScale = scale;
                     Quaternion q = prefabGameObject.transform.localRotation;
                      bool rot90 = BuilderUtil.IsRawTileFlagSet(rawTile, tk2dTileFlags.Rot90);
                     instance.transform.localRotation = q * Quaternion.Euler(0, 0, rot90 ? -90 : 0);


                     // Add to tilePrefabs list
                     TilePrefabsX.Add(baseX + x);
                     TilePrefabsY.Add(baseY + y);