Hello Guest

Author Topic: Multiple collider islands in tiles not working with 2D colliders  (Read 3943 times)

Fault

  • Guest
We've recently tried to move to the 2D physics system, but we're facing an issue regarding tilemap colliders.

Thing is, we have multiple tiles with polygon colliders that consist of two islands, but the generated colliders are coming out all wrong. I've attached a picture of how the generated colliders in the tilemap looks and pictures of some of the tiles from that picture with their polygon collider. As you can quite easily tell, they look almost nothing a like, some of the islands are even missing.

I tried the tilemap demo scene and added another island to one of the tiles and the exact same thing happened.

Any ideas?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Multiple collider islands in tiles not working with 2D colliders
« Reply #1 on: January 30, 2014, 11:30:58 am »
This is a bug. Thanks for reporting it.
It'll be fixed in the next release, or if you need it sooner add the following lines to tk2dTileMapColliderBuilder2D.cs

Line 192 or so....
                  foreach (tk2dCollider2DData dat in spriteData.edgeCollider2D) {
                     baseVertexIndex = verts.Count;
                     foreach (Vector2 pos in dat.points) {

Line 210 or so....
                  foreach (tk2dCollider2DData dat in spriteData.polygonCollider2D) {
                     baseVertexIndex = verts.Count;
                     foreach (Vector2 pos in dat.points) {

Fault

  • Guest
Re: Multiple collider islands in tiles not working with 2D colliders
« Reply #2 on: January 30, 2014, 05:34:05 pm »
Thanks for the quick response!

The fix worked beautifully. :)