2D Toolkit Forum
2D Toolkit => Support => Topic started by: Logon on February 19, 2013, 07:01:09 am
-
I have a problem where a tilemap 100x100 32x32 turns up really small compared to another sprite in my scene
The Scale on the tilemap is x 32 y 32 z 0
The scale on my charactersprite is 1 , 1 , 1
In pixels the tiles should be 32x32 and the character be around 50x50ish but if you look at the editor window you can see the the tiles are very small because the charactersprite is pixel perfect in the game window.
Any ideas?
(Sorry for the bad english)
-
The sprite size in the tilemap depends entirely on the sprite collection size. Perhaps they are set up differently?
-
That fixed it, i forgot to use tk2dCamera.
-
Actually, I'm having this problem as well. Generally, I have to scale up the tilemaps to x12 to get it around the size I'd like.
I'm not using the tk2dCamera, since we're using perspective parallax. Is there no way to force 1:1 pixel perfect on a tilemap like other sprites?
-
Use this bit of code to calculate the scale. It is obviously dependent on the distance to your perspective camera.
float zdist = (tilemap.transform.position.z - Camera.main.transform.position.z);
float s = tk2dPixelPerfectHelper.CalculateScaleForPerspectiveCamera(Camera.main.fov, zdist);
And set s to the tilemap scale, and thats it.
You can also get the scale by dragging a sprite from the same collection used in the tilemap, position it at the same z distance as where the tilemap is, 1:1 it, and use that scale value on your tilemap.
-
That did the trick, thanks again!