I am making currently a radar/minimap and I ran into one issue. I am checking if the blip is within the minimap’s rect by using Rect.Contains method and for the rectangular minimap this works just fine, but for the circle shaped minimap this doesn’t apply anymore.
Is there a way to check this for the circle shaped minimap? Thank you.
Funnily enough I have been playing around with a Circle based radar. I’m guessing your issue is that the Blip shows up past the circle in the top left, right and bottom left right?
I’m also assuming you are doing a math based radar? Not a camera being drawn onto a Rect with RenderTexture?
Just check if the position of the Blip is within a radius from the center of the radar;
// Ratio of how big the radar is on the screen
float radarScale = 0.2f;
// Get width of radar based on screen
float _radarWidth = (Screen.width * radarScale)
// distance between what is the center of your radar (could be player transform)
// and the transform of the Blip (e.g. enemy)
float dist = Vector3.Distance(centerPos, enemyPos);
// if distance less than 90% the radarWidth divided by half (to give radius)
if (dist <= (_radarWidth * 0.9f) * 0.5f)
// Your draw logic here
I do 90% of the width because then it doesn’t draw it on the actual edge of the circle, meaning it stops drawing the blip just before it hits the circle edge