[Solved] How to trap a object in side a circle

Hello,I was planning to participate in ludum dare and got an idea of the player trapped in a circle and enemies try to kill the player and the circle will shrink if the enemy comes close.But,I am facing a problem of how to make the player not go outside the circle.I tried using collision mask on the outline and seperate the object when colliding but it did not work, It said that the mask is not convex ,so I tried using 4 different mask on each corner but still said it is not convex and was having some bug and the mask was not working properly .I also tried the physics engine but the collision mask was not being detected. Can you say if there is any other way or am I using it the wrong way.Sorry for making it long.

You could try placing an invisible object centered within the circle, then test the character’s distance from the invisible object and move the player towards the invisible object when the distance is exceeded.

Another possibility (because of the convex collision masks) is to split the circle in half, and use two objects to compose the circle.

1 Like

Thank you so much❤️.I will do accordingly