Hello Guest

Author Topic: Tilemap Tile scale  (Read 5367 times)

Pfaeff

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Tilemap Tile scale
« on: March 02, 2013, 03:21:20 pm »
Hi,

I want to create a mesh that has the same size as the tiles drawn by the TileMap. I can get the tile position with GetTilePosition(x, y), but how do I get the correct scale?

Greetings,
Pfaeff

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap Tile scale
« Reply #1 on: March 02, 2013, 03:35:56 pm »
The tilemap doesn't use any special scale. If you create a sprite using the same collection as the tilemap, it will be the same size.

If you need to use another collection, then make sure the settings (ortho size & resolution height, or use tk2dCamera) is the same on both.

Pfaeff

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Tilemap Tile scale
« Reply #2 on: March 02, 2013, 03:58:30 pm »
My sprites have a scale of (1,1,1). But if I create a cube of scale (1,1,1) it is a lot bigger. By what amount do I have to scale the cube to fit the size of my sprites? I am using the default Unity camera by the way.

EDIT: I managed to switch to tk2dCamera. That would mean, I can work with pixel-values, right?
« Last Edit: March 02, 2013, 06:11:52 pm by Pfaeff »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap Tile scale
« Reply #3 on: March 02, 2013, 09:21:05 pm »
Using tk2dCamera, 1 unit = 1 pixel. That makes it easier a bit to manage sizes, but its possible with any arbitrary sizes too.

orthoSize / targetHeight = scale per unit for all other cases. So you will have to scale your cube using that value (set in the sprite collection editor) to make it match sizes.

Pfaeff

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Tilemap Tile scale
« Reply #4 on: March 02, 2013, 10:45:31 pm »
Thank you very much  :).