- Home /
Question by
PrOScANneRDiV · Feb 06, 2018 at 11:29 PM ·
2drigidbodycollider
How do I stop the player from going through walls? (2D) [CLOSED]
I'm using Unity 5.6.1f1 and the title is my question.
Here are my prefabs:
I've turned on the box collider and checked "Is Trigger" and used the rigidbody:
But the player is still going through walls. How do I prevent this?
I need "Is Trigger" on for my OnTriggerEnter function in a c# script
prefabsunitymaze.png
(5.6 kB)
playertoolcapture.png
(37.5 kB)
Comment
Best Answer
Answer by Carterryan1990 · Feb 06, 2018 at 11:40 PM
1st off you need a 2d box collider and a 2d rigidbody. And then Is trigger needs to be off. When a collider is checked trigger it no longer stops collisions.
$$anonymous$$y mistake. You're right. I need to use OnCollisionEnter ins$$anonymous$$d of OnTriggerEnter.