Log in or register to post comments

Help with Vuforia for Hololens sample

February 15, 2017 - 3:11am #1

Hi all, I'm familiar to C#/WPF but very new to HoloLens development (ie UWP, Unity, Vuforia...).

I am trying to start/stop some backend actions upon Vuforia ImageTarget found/lost, and the learning curve is steep indeed. :-)

I have opened, deployed and run the Vuforia for HoloLens sample and I see ImageTarget children diplayed (ie the teapots, cursors, UI Canvas & own children...) when my targets are detected. So far so good. Now I need to also do some backend stuff when Vuforia ImageTarget is found/lost. The Vuforia for Hololens sample tutorial says:


The Default Trackable Event Handler component is responsible for handling callbacks to the Image Target Behaviour arising from changes in the state of the Image Target, such as when it has been detected and is then being tracked.

This script is used to enable and disable rendering and collision detection on digital content that is a child of the target. Extend this script’s OnTrackingFound() and OnTrackingLost() methods to implement custom event handling for your app.

I am not sure what this means exactly. Does "Extend this script's methods" mean "extend" as in inheritance, ie write a script like:

public MyCustomTrackingHandler : 
                   DefaultTrackableEventHandler {

    protected void OnTrackingFound() {
        // extra behaviour here

    protected void OnTrackingLost() {
        // extra behaviour here

Or do they mean implement extra behaviour directly within the DefaultTrackableEventHandler's source ?

Because OnTrackingFound() and OnTrackingLost() being private in the DefaultTrackableEventHandler, they are not visible from children classes by default. So - as far as I understand - I must change the default tracker class either way (to make OnTrackingFound() and OnTrackingLost() protected or to implement my extra behaviour) which is not very good practice.

Or else again, is it that it is only possible to "extend" with a children class in the Unity scene hierarchy?

Can someone clarify how to do that, or point me to a (hopefully basic) documentation where I can figure out how I am meant to implement custom backend event handling for my app? best practice preferred, hacky tricks still worth a shot ;-)

Log in or register to post comments