- Home /
OnCollisionEnter2D is called but the actually collision isn't resolving.
So I'm having an issue that is proving tricky to track down. I have a 2D game where the player pulls a dog on a leash. I'm trying to make it so that the leash doesn't phase through walls. I put the leash object and the walls on a separate layer called blockleash. I know the collision is happening because the OnCollisionEnter2D is called from the leash script everytime it should collide, but there is no noticeable difference in the scene. The leash phases through just as before. The structure I have for the relevant components is as follows:
The player has a box collider2D and a dynamic rigidbody2D.
The leash object has an edge collider2D and a dynamic rigidbody2D. It's also a child of the player and is on the blockleash layer.
The dog object has a box collider2D , a distance joint2D that points to the player's rigidbody2D and a dynamic rigidbody2D.
The wall has a box collider2D and a static rigidbody2D. It is also on the block leash layer.
The dog and the player both move on their own using rigidbody2D velocities.
Is there some detail I'm missing that prevents the physics from actually working in the scene?
Thanks