- Home /
Player object passing through walls in Unity2D?
I have applied Box Collider 2D and Rigidbody2D to both of them (Walls and player) even though the player object is passing through the walls.
The walls need only a BoxCollider2D and the Player a BoxCollider2D and a Rigidbody2D. Be sure the colliders have the box IsTrigger to false. How are you moving your player? If you have a script send it so we understand better.
How are you moving the player? Are you directly setting Transform.position? Are you using Transform.Translate? Are you using Rigidbody2D.AddForce? $$anonymous$$any methods of movement do not respect physics / collisions, so as the user above said, we need to see your script to be able to help. It would also be a good idea to include an inspector screenshot. :)
Answer by Ragegamedude · Jun 05, 2018 at 07:06 PM
check if the component is active and be sure to uncheck trigger checkbox.