Hello Guest

Author Topic: Rotating a Tilemap  (Read 4056 times)

Adam2Marsh

  • Newbie
  • *
  • Posts: 2
    • View Profile
Rotating a Tilemap
« on: January 12, 2014, 02:14:30 pm »
Afternoon All,

Are you able to flip a tilemap 180 in runtime?
I can flip easily while editing but once the game is running no matter what I change in the editor it won't change the rotation.

I did have a search but couldn't find any answers to what I'm trying to do.

Thanks In Advance :) and sorry if this is a silly question...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Rotating a Tilemap
« Reply #1 on: January 13, 2014, 10:36:09 am »
Hi, what are you changing and where? You will need to change the tk2dTileMap object, not the tile map data object. You probably don't want to do this if you had colliders on the tile map as that would be quite expensive. If you just need to go "in reverse" remember that you can also rotate your camera so its looking from the other direction. i.e. positioned in +z and rotated 180 deg. Not sure if that'll do what you need to, but its much much cheaper.

Adam2Marsh

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Rotating a Tilemap
« Reply #2 on: January 13, 2014, 07:18:45 pm »
Hi,

Thanks for the response.

I found the issue why the tile map wasn't updating after I had rotated the tilemap object and it's because I wasn't rebuilding it. (Added TileMap.Build() which worked) What I'm trying to do is rotate the our level (which is a tile map) so the player is walking on the ceiling but in the same direction at runtime.

I did try to make the character walk on the ceiling but the character controller I'm using has its own in built gravity which was proving to be a pain, so thought it'd be easier just to flip the level.

So it's a bad idea to mess with the tilemap while the game is playing? I've got it rotating currently (with a small level) and not seen an issue yet.... Except that the rotation isn't working as expected, the tilemap moves up rather than rotating.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Rotating a Tilemap
« Reply #3 on: January 14, 2014, 10:44:03 am »
The tile map has a mesh collider attached to it. I'd avoid rotating that as much as possible. The tile map origin is at the bottom left, so if you rotate it its going to rotate around the origin. It should work, there isn't anything stopping it from doing so.

Can you post some screenshots if you're still stuck with this. What do you mean by "moves up"