I’m designing a Minimap for my games HUD. At the moment it is square, but I want it to be a circle. It works by a Ortho Camera above the player to create a render texture. I can also create an arrow to point to mission objectives, which it disables when the objective is within camera view.
In order for the Minimap to be round I need to add a Camera mask so that it doesn’t detect the objective outside the circle. This is proving extremely difficult. I’ve tried raycasting, collision detection, etc. and nothing works. I’ve looked all over the internet for a solution, but they just make me lose my temper.
Please help.
I’ve found a simple solution. I can measure the distance between the player and the waypoint, then use the camera orthographicSize to create a radius to detect if the objective is in view.
if (currentWaypoint == null) return false;
Vector3 point1 = currentWaypoint.transform.position;
Vector3 point2 = cam.transform.position;
point1.y = 0; point2.y = 0;
return Vector3.Distance(point1, point2) < cam.cam.orthographicSize;

You can have a minimap that’s just a topdown camera… but that’s not very efficient and gives you little control over the content. I’d suggest that you
- Render the topdown camera only when necessary. That might as well mean it’s pre-rendered and stored as an asset. It lets you modify the minimap texture content by hand for better clarity.
- Add sprites over the minimap in canvas, for objects you want to highlight. Is there an objective? Is there a marker showing where the enemies are? Don’t render it to the same texture as minimap background, move canvas elements inside the minimap rect instead.
- Write a custom shader for the minimap canvas renderer that masks it to be a circle. Or use built-in masks, whatever works better for you.