Problems with tilemaps of Unity 2d-extras
Hi folks
idea is this -> in-game
Sprites are available here: sprites
As you can see it's a simple tilemap with grid colliders (not sprite colliders) that simulates depth having sprites greater than tile grids. Image explain better thank my words.
My settings:
Unity version: = 2019.1.7f1 Package used: = Unity-Technology/2D-extras My sprites used by tiles = https://www.piskelapp.com/user/6340638603739136/public PixelToUnits = 500 Tilemap grid = 0.256 x 0.256 Tile palette grid = 0.256 x 0.256 Anchors = 0.5 x, 0.5 y Colliders type = grid Sprites dimension = 128 x 128, 128 x 256, 256 x 256 Pivot of each sprite imported = {floor_left : (x : 0.75, y : 0.25), floor right : (x : 0.25, y : 0.25), new_ground : center, floor1 : (x : 0.5, y : 0.25)}
As you can see all calculations are correct, based on my pixel per units import.
Problem is that composite collider that use tilemap collider doesn't properly work because, as you can see in image, tile colliders are not merged. They are merged only if I decrease grid dimension from 0.256 to 0.25, but if I do so, images are obviously not correct with tiles.
Tried to decrease composite collider vertex and offset distance but this doesn't resolve problems.
In addition to this, I noticed another issue: if you zoom wth camera sprite in tiles are slightly detached (image here: https://ibb.co/bFmMvK1).
I'm struggling some days, but I can't figure out where I'm wrong.
To reproduce:
import sprites with ppu as 500
Set pivot of each sprite like I described above {floor_left : (x : 0.75, y : 0.25), floor right : (x : 0.25, y : 0.25), new_ground : center, floor1 : (x : 0.5, y : 0.25)}
Import unity 2d extras (download from here and move to your project's "Assets" folder)
Create tilemap and tile palette with grid of 0.256 for both x and y and set ad tilemap your active tilemap
Add sprites to your tile palette and for created tiles set collider type as grid (not as sprite)
Add a tilemap collider to your tilemap, make it used by composite and add a composite collider too
Please help me.
Answer by Pilessio · Jul 03, 2019 at 12:31 PM
Resolved increasing property "Extrusion factor" "TilemapCollider2D".
You have to delete every ile you painted in tilemap, increase this value from 1e-05 to 1e-03 and repaint you tiles. Now composite collider will work.