Search code examples
c#unity-game-engineaugmented-realityvuforia

Display text/image while Vuforia plane finder is detecting surface


I am developing a game with Vuforia in Unity. What I am attempting to do is to display a Plane/Canvas/Image while vuforia is detecting the surface so my users will not feel lost while Vuforia is scanning. But the problem is i've looked into the only 2 available scripts that i can find,

DefaultTrackableEventHandler.cs 

and

DefaultInitializationErrorHandler

but I could not pin point the script where it initialize the detection.

So my request is to ask if anyone know which part of the code does Vuforia initialize the scan so i can customise it.


Solution

  • I am assuming you are using ground plane since you have written " detecting the surface " The plane finder behavior script is responsible for "scanning" and finding horizontal surfaces. What you can do is check vuforia samples from asset store and there you can see this script is doing Hit tests constantly to find positions on the detected surfaces. Therefore, as long as this on Automatic Hit Test is called, it means your device has found a surface and performing hits towards your indicator.

    enter image description here

    In this example HandleAutomaticHitTest attached to PlaneManager is called every time Automatic Hit Test is called. You can modify this HandleAutomaticHitTest script to achieve what you wanted. One last note i am not 100% sure but the scanning probably starts when the positional device tracker is started or vuforia started.