Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unusual behaviour with TriggerEnter/Exit and TilemapCollider+CompositeCollider

Discussion in 'Physics' started by Cerzi, Sep 26, 2018.

  1. Cerzi

    Cerzi

    Joined:
    Dec 28, 2014
    Posts:
    12
    Not sure if this is a bug or whether I've done something wrong.

    For clarity's sake I've put up a demo project that expresses the problem here:

    https://github.com/Cerzi/UnityCompositeColliderBugTest

    Basically, the OnTriggerExit is fired when a moving collider passes within the tilemap's composite collider. This means that as the square moves across the tilemap collider, trigger enter and exit are called two times each, instead of a single time like one would expect.

    Does anyone know of any workarounds for this? it isn't intended I'm guessing?
     
  2. OtakuD

    OtakuD

    Joined:
    Apr 24, 2014
    Posts:
    49
    Sorry for old bump but I discovered this and since found the issue, the composite collider has a "Geometry Type" setting which defaults to "Outlines" resulting in the above behaviour, similar to an edge/line collider. Changing it to "Polygons" makes it behave like a solid shape.
     
    nickhe2003 likes this.
  3. Wip3ou7

    Wip3ou7

    Joined:
    Mar 9, 2015
    Posts:
    41
    Where is this setting at?