Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

Customise Vuforia's OnTrackingFound() & OnTrackingLost() ?

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 customise what happens 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() {
        base.OnTrackingFound();
        // extra behaviour here
    }

    protected void OnTrackingLost() {
        base.OnTrackingLost();
        // extra behaviour here
    }
}

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

Because OnTrackingFound() and OnTrackingLost() are 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 ;)

Sign In or Register to comment.