Hi, I have opened, deployed and run the Vuforia for HoloLens sample and I can see 3D models diplayed (ie the teapots, cursors...) when my targets are detected. So far so good. Now I want to implement a different behaviour instead of showing 3D models and I get stuck.
The Vuforia for Hololens sample tutorial says:
[quote]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.[/quote]
When they say "Extend this script's methods", do they mean "extend" as in inheritance, ie write a script like:
public MyCustomTrackingHandler : DefaultTrackableEventHandler { private void OnTrackingFound() { base.OnTrackingFound(); // extra behaviour here } private void OnTrackingLost() { base.OnTrackingLost(); // extra behaviour here } }
Or do they mean add extra behaviour directly within the DefaultTrackableEventHandler's methods ?
Because OnTrackingFound() and OnTrackingLost() being private in the DefaultTrackableEventHandler, they are not visible from children classes by default... But modifying the DefaultTrackableEventHandler source directly seems messy to me - howverer I am new to Unity development so maybe I'm just not familiar with the proper way to do things?
(Also, am I the only one to find this confusing?)
DefaultTrackableEventHandler
DefaultTrackableEventHandler is just a default implementation. You can copy its' code to your custom handler class and modify it in the way you like. Then remove default handler component from game object add your modified handler instead.