- the camera and game object (menu or button) are close enough
- or when the camera transform is at the position of the game object
I have attached a screenshot attached so you can get the idea
When the cursor focuses on the button to click, there should be an event triggered, let’s say play a sound until the camera and object transform are far away.
I would really thank you guys for the help
If you want it to trigger once the object actually collides:
Add a collider to your camera, then use the function OnCollisionEnter in a script to trigger your actions. Set the collider size to your choice based on how far away you want it to trigger from.
If you want it based on a person focussing their sight on it:
Make a function to call a constant raycast. If a raycast hits an object, async call for a later function with a similar repeating raycast. If the raycast ever falls on another object during the timer countdown, recall the function and cancel the action. This is definitely more complex but easily achievable.
I can write code for either of these, just comment on the one that you want and I’ll get right to it.
@jaca6767
Basically, I am trying to achieve a warning system in augmented reality, so it’s like a marked area (danger zone) in which when a player (camera) enters or collides to its boundary it should trigger an event like showing a warning or playing a siren and similarly stop playing when it leaves the area. I will show you an example like the circle as a danger zone.
I am very glad to have a quick response from you and would really appreciate your help doing this.
Thanks