Checking when an object is in a specific part of screen
Hi! I have a 3D game that I'm working on, and I want to detect when an object is in a certain part of the screen. I have a UI canvas with 4 empty images with 2D Box Colliders, and I've been trying to figure out how to detect when the object is inside them. I have the screen position of the object shown here:
Vector3 screenPos = Camera.main.WorldToScreenPoint(rodTip.transform.position);
And I found this script: https://docs.unity3d.com/ScriptReference/Bounds.Intersects.html
But I'm having trouble putting it together, I guess? Any help would be super great!
(I found @Hexagon-Neuron's question on the topic but the answer given wasn't really super helpful, so I assumed reasking it was okay)
https://answers.unity.com/questions/495102/detect-object-in-a-specific-part-of-the-screen.html