Question by
D_F4u1t · Jan 26, 2020 at 04:50 PM ·
collisioncollider2dtilemap
How to get position of tile on Tilemap Collider 2D?
collision2D.transform.position only seems to return the position of the tilemap world itself, but I somehow need to identify the position of the tile the player collided with.
I searched the internet for this and there's not too much talk about it and all I've found are workarounds that don't help me too much.
Comment
Duplicate question: https://answers.unity.com/questions/1572343/how-to-detect-on-which-exact-tile-a-collision-happ.html
It's a verbose solution, but basically find the contact point, and convert it to tilemap positions
Found out what I did wrong. I was outputting contact.collider.transform.position rather than contact.point which did the trick. Thank you