Search code examples
c#unity-game-enginegame-physicsboundary

How can I make a "mobile" boundary in Unity?


I've been working on an Undertale fangame and I'm facing a problem. In the fight box, the Player's soul (aka character) can pass the Edge Collider and go through the edge. I was thinking about using a Boundary instead, but I want to make the fight box move during the attacks, so I need to move the boundaries with the box. How can I do that? enter image description here


Solution

  • It should work with an edge collider. It's important that you use the EdgeCollider2D, because it is a 2D game. Does your player have some sort of Collider2d as well and is the "Is Trigger" option set to false on both colliders? If you then want to move the EdgeCollider2D, you can just move the GameObject.