The TrackerWrapper plugin consists of three main C# scripts which can be found in the Assets/Plugins directory of the Unity TrackerProject.

  • The TrackerManager.cs script is usually attached to the main camera and manages the creation and polling of all marker-based tracking objects. This script maintains a reference to the VideoCamera script from which it gets camera frames. The manager script also uses one of the filenames from calibration files located in Assets/Resources. At runtime, these text files are recreated in the Assets directory from bundled resources. This process is used because text files on the iPhone must be included in these bundles and recreated at runtime.
  • Each Unity GameObject that is to move with a single marker has an attached TrackerSingleMarker.cs script. This script defines the type of marker pattern used, the size in mm of the marker and the associated id number of the marker. Leaving the id at -1 indicates that the tracker should learn markers and populate that TrackerSingleMarker element with the id of the discovered marker. If multiple scripts are in learn mode results are undefined. If multiple markers are found, the largest marker is returned as the learned marker id.
  • The TrackerMultiMarker.cs script will update the position of any GameObject to which it is attached. The multi marker script takes the name of a multimarker definition file located in the Assets/Resources directory. Both the ARToolKitPlus and StbTracker versions of the TrackerWrapper bundles/dlls are designed to work identically. However, the name of the configuration files read by TrackerMultiMarker.cs is *.cfg for ARToolKitPlus and *.stb for StbTracker.

The tracker manager has optional settings for camera threshold value (default auto), half-size images, pose filtering, corner filtering, image dumps and a debug windows for plugin messages. Both single and multi markers take optional configuration parameters that are given to the plugin. These include the use of RPP pose prediction instead of Guass-Newton prediction, fixed point calculations instead of floating point and thick bordered markers instead of thin bordered markers. Perhaps the most important option for single and multi markers is the toggle between Camera Relative and World Fixed. In camera relative mode, the location for each marker is updated relative to the current camera position. In world fixed mode, the marker position is not updated but rather the camera is updated to make the marker appear in position relative to it. Only a single marker can be in World Fixed mode and assigning multiple markers is undefined. The TrackerMap.cs script and associated demo scene sets the largest visible marker to World Fixed and the other markers to camera relative.