I want to have a camera follow a player where the player remains at the center of the camera at all times unless the camera would be outside the designated camera bounds. If the camera bounds were in a clean rectangular space it would be simple to check if the desired camera position would be out of bounds, and update the actual position accordingly. I’m not sure how I would do this for a complex shape that could have angles or even curves.
If a player is up against an angled wall, i don’t want the camera to clip outside of the bounds, but for the player to appear at the edge of the camera.
I thought about doing this with the physics engine itself, but this causes the camera to rapidly jiter as it tries to forcefully enter a space where a collision would be. Is this something I’d use the physics engine for? How can I check the closest position an object could be in given the collisions around it?