Log in or register to post comments

Display UI Element on defined Area in Area Target

June 17, 2021 - 3:06am #1

Hi,

I'm new to Vuforia, I would like to know that is it possible to display a UI Element (Button) when the camera enters to a predefined small area inside the area target? If yes, Please tell me how!

Display UI Element on defined Area in Area Target

June 17, 2021 - 4:51am #2

Yes, you can put a collider volume in an area target with the desired shape and size, and set up whatever functionality you like with Collider.OnTriggerEnter method. In that method you can set your UI element to active, or tween the canvas group alpha from 0 to 1, or anything else that serves your purpose.

Put another collider on your AR camera object and attach a rigidbody to it.

Look up Collider.OnTriggerEnter in Unity documentation or the forums, there are plenty of different cases/examples.

As an alternative, you can also measure the distance between the camera and some empty game object and when the distance is less than your desired value, activate the UI element. In this case your area is spherical because it measures distance from a single point.

I am not sure which method is more efficient in this context to be honest, but the first one is considered the best practice from what I've seen so far. While second can still be viable as the distance calculation is not too costly and it is easier to implement for a beginner.

Log in or register to post comments