Hello Unity! I am making a 2D game, and I have tried putting box colliders on my furniture. It works great, except when my player continues to run into the furniture, my player shakes. How can I prevent this, and make my character just stop moving when it runs into the furniture?
You could do something like…
(note: rb2d would be your character’s RigidBody2D that you got a reference to outside of this method)
void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.tag == "Furniture")
{
rb2d.velocity = Vector2.zero;
}
}