0
votes

Very simple, I created an object that simply serves as a box collider that sits over the background. When the player character runs into it, I want the character to stop, but they just walk right through it. I have both of their colliders set to 2D box colliders, neither of them have the trigger option checked, and both are rigid bodies.

1
did you add the rigidbody2d? or rigidbody? having collission issues usually boils down to some form of mismatch - BugFinder
Also, you probably already ensured that in your Edit -> Project Settings -> Physics -> Layer Collision Matrix, the two used layer types are not unchecked for collisions among each other. - Philipp Lenssen
Please show screen shots of your inspector for both objects. - Jonathan Alfaro

1 Answers

0
votes

My guess is that you are using Transform.position to move the player.

All rigid body objects should be moved using the rigid body specific rigidbody.velocity function. Transform.position is practically teleportation while, rigidbody.velocity actually moves the rigidbody component. Allowing for the 2d colliders to take action.

Hope this helps!