2D Toolkit Forum

2D Toolkit => Support => Topic started by: Pfaeff on March 02, 2013, 03:21:20 pm

Title: Tilemap Tile scale
Post by: Pfaeff 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
Title: Re: Tilemap Tile scale
Post by: unikronsoftware 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.
Title: Re: Tilemap Tile scale
Post by: Pfaeff 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?
Title: Re: Tilemap Tile scale
Post by: unikronsoftware 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.
Title: Re: Tilemap Tile scale
Post by: Pfaeff on March 02, 2013, 10:45:31 pm
Thank you very much  :).