Customizing the Sample
The quickest possible way to test your own VuMark databases is to exchange the VuMark GameObject’sdatabase with your own in the VuMark Behaviour component.
- Follow the instructions on creating your own VuMark Template in Adobe Illustrator and download the resulting database as a .unitypackage from the Vuforia Target Manager.
- Import the database into your Unity project by selecting Assets -> Package -> Custom Package.
- Select the VuMark GameObject and replace the database in the dropdown menu with your own.
- If applicable, adjust the data type and IDs in the VuMarkHandler GameObject to fit with your VuMark template.
- Make sure to add a Vuforia License key as described in How To add a License Key to your Vuforia Engine App
- Test your VuMark instances by generating and download them from the Target Manager and print them without scaling them. A guide on generating instances can be found in How to Work with VuMark Databases.
Default Trackable Event Handler
The VuMark Trackable Event Handler component is responsible for handling callbacks to the VuMark Behaviourarising from changes in the state of the VuMark Trackable, such as when it has been detected and is being tracked.
This script is used to enable and disable rendering and collision detection on digital content that is a child of the VuMark GameObject. Extend the script’s
OnTrackingLost() methods to implement custom event handling for your VuMark and app. See Interpreting Tracking API Results for details on the VuMark’s tracking states.
Enabling/Disabling Extended Tracking
Using the Device Tracker for extended tracking enables you to maintain tracking for a scene even when the VuMark is no longer in the camera view. This enables you to place content further away from the VuMark, See: Device Tracking Overview
The Device Tracker is enabled by default, but you can manage it at build time in the Vuforia Configuration or at runtime at initialization by calling the
PositionalDeviceTracker. Control when to render augmentations iftracking accuracy of a target is reduced significantly; when the status is switched to LIMITED, you may choose between continuing rendering augmentations or wait until EXTENDED_TRACKING is reported once again.
The size of a VuMark is controlled through its template and needs to correspond to the physical size of the printed VuMark. All instances of the template will use the same size.
For use cases where different VuMark instances have different sized, you can use the
setSize() methods of the VuMark class to change the size at runtime. You can also use the Virtual Scene Scale Factor in Unity to translate between real-world size and virtual scale in your Unity scene.
If two different sized VuMark instances of the same template are being tracked at the same time, at least one of them will be scaled wrongly. To avoid unexpected tracking effects, disable the device tracker in such a case.