Tilemap Collider 2D w/ Composite Collider Not Working


#1

Hi there,

I’ve implemented a tilemap into my 2D scene using the Unity Tilemap asset. When I setup the tilemap to use a “Tilemap Collider 2D” (equivalent of a box collider per tile) the A* grid seems to work great.

However, if I set the tilemap to use a composite collider (changing the box collider per tile setting to 1 collider per shape (not tile)), the A* grid is unable to show the walk and no walk areas (only walk areas show).

It would be nice to be able to utilize composite colliders as it reduces the number of collision areas on the screen, thus making it a bit lighter on cpu utilization.


#2

Hi

This seems to be a Unity bug I think. My package uses the Unity physics methods Physics.OverlapPoint and other similar methods that claim to return if there is an obstacle at the specified position.
I did find another user with the same bug: https://www.reddit.com/r/Unity2D/comments/7qoqnv/composite_collider_2d_bug/?st=jejqdh9m&sh=b0b14931


#3

Any update to composite collider?


#4

I do not know if that bug has been fixed. You could try out the latest Unity beta perhaps?


#5

Fixed in today’s 4.2f2 LTS update. Though I didn’t find that been mentioned in changelogs.


#6

Hi Aron any news on this I need my titlemap with compsite collider working


#7

@Thai_Binh_Nguyen according to @favoyang it has already been fixed. Are you using a somewhat recent version of Unity?


#8

I’m on 2017.4.6f1 which one higher version of favoyang mention above. Can you check it again?


#9

I’m using 2018 2.0b11 now and it works in this version.


#10

thanks @favoyang this one 2018 2.0b11 still beta right?
When it release I will try it, thank you a lot


#11

@favoyang @aron_granberg
I tested it today it not working. @favoyang can u give some guide or screenshot?
@aron_granberg please check it out
I use latest unity version 2018.x


#12

I know this is an old post, but I was also trying this today and realized the issue I was having. By default, the composite collider uses “Outlines” for its “Geometry Type” attribute. If you change this to “Polygons”, it may work for you. This seems to fix the issue if the graph wasn’t working properly if the node collider was able to fit entirely within an obstacle.


#13

My tilemap inspector

My player inspector
player

I think my setup is very trivial

  • The tilemap (walls) is a static body, collider geometry type is outlines.
  • The player is driven by pathfinding module, which reply on the tilemap collider to find the obstacles.
  • The player is also a kinematic body with trigger collider to detect enemy or door.

Anyone with problem on composite collider may create a small project on github to help reproduce the issue.