2D Box Collider Clipping

I am making an RPG game in unity 2D. I used a tilemap collider to put walls for a house, but my player keeps clipping through the wall a little bit then popping back out of the wall. For my movement script, I do use the transform.translate to move. I use this because I am following a youtube RPG tutorial series. So I am looking for a solution that doesn’t involve me changing the script to physics. Thanks.

1 Answer

1

Using transform.Translate will always cause these kind of issues as it disregards the physics system. You’ll have to move your object using the physics system, by accessing your Rigidbody component. Either you can use AddForce or what may be easier is setting the velocity directly.

This is my code, how would I change it I dont know how without messing up my Animations

–