Markerless Tracking

From Kudan AR Engine
Jump to: navigation, search

- 1.2+

Kudan offers the tracking of objects without requiring a marker. In order to use this in Unity, you will need to add an object with a Markerless Driver script and place objects as children of it. This tutorial assumes you have previously set up a Kudan project before and have at least a basic understanding of how to use the Unity Editor. If you have not, it is recommended that you go over the “My First App” tutorial, as well as some of Unity’s own tutorials to gain a better understanding of these applications.


1. Place the Kudan Prefab in an empty scene.

Markerlessimage001.png


2. Create a new empty object and add the “Markerless Transform Driver” script to it.

Markerlessimage002.png


3. Tag the “Markerless” object as Markerless by adding a new Markerless tag in the project settings, then setting the object to that tag.

Markerlessimage003.png


Markerlessimage004.png


4. Place an object, for example a cube, as a child of the empty “Markerless” object. Remember to scale it up so it can be seen.

Markerlessimage005.png


5. Check the Kudan Camera Object to make sure its default tracking mode is set to Markerless. If it isn’t, ensure there is a child object (ours is called “MarkerlessTracking”) of the “Kudan Camera” object containing the “Tracking Method Markerless” script, then change the default tracking method on the Kudan Camera to be the object containing that script.

Markerlessimage006.png


6. Create a new script (we have called ours “PlaceMarkerlessObject”) and open it.


7. Within the script, declare a public variable KudanTracker. This is part of the Kudan.AR namespace, so either state the namespace of the script or put “Kudan.AR.” in front of the variable. Create a new public void function (we called ours “PlaceClick”). Within it declare two more variables, a Vector3 and a Quaternion. These will make up the transform of the object we are going to place. Call the FloorPlaceGetPose and ArbiTrackStart methods from KudanTracker, using the Vector3 and the Quaternion as the two arguments respectively. Make sure to use the out modifier for the variables passed into FloorPlaceGetPose so they can be properly assigned.

Markerlessimage007.png



8. Create a canvas and place a button on it. Add the script you just created to the button. If there is not already an event in “On Click()”, click the + icon to the lower right of it. Add the button object to “On Click()” either by dragging and dropping it from the hierarchy onto the variable, or by clicking the small circle and finding the button object. Then, click the drop down, find the script, and click the name of your function (ours was “PlaceClick”). Also ensure at this stage that all scripts have the appropriate references.

Markerlessimage008.png



9 Within “Scripts/Components", there should be a script called "TargetNode.cs". Place this onto the same object that has “PlaceMarkerlessObject” and make sure the references are correct.


10. And we are done. Building the app should result in you having a target node on your screen that disappears when the button is pressed, and an object is placed in your camera view, without requiring a marker.