Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TilemapCollider2D: get tile colliding with an object

Discussion in '2D Experimental Preview' started by falukorv, Jul 14, 2017.

  1. falukorv

    falukorv

    Joined:
    Jul 14, 2017
    Posts:
    2
    With TilemapCollider2D, is there a way to obtain the specific tile that is colliding with an object?

    This is what I'm doing for now, but it doesn't feel like the right approach:
    - in OnCollisionEnter2D, find collision point between TilemapCollider2D and the other object,
    - convert collision point to grid coordinates,
    - using the other object's velocity, adjust these coordinates to obtain the position of the collided tile.