Log in or register to post comments

Unity Extended Tracking Issue

October 30, 2014 - 11:55am #1

Trying to enable/disable extended tracking, using the unity method provided in the documentation.
 

public void UseExtendedTracking(string trackableNamebool enabled
    {

        IEnumerable<TrackableBehaviourtbs =
            TrackerManager.Instance.GetStateManager().GetTrackableBehaviours();
        
        foreach (TrackableBehaviour tb in tbs) {
            // check trackable name
            if (tb.TrackableName.EqualstrackableName )) {
                if (enabled
    
                    tb.Trackable.StartExtendedTracking();
                else
                    tb.Trackable.StopExtendedTracking();
                return;
            }
        }
    }

 

I get the following error in Unity: Trackable does not contrain a definition for 'StartExtendedTracking' and no extension method 'StartExtededTracking of type 'Trackable' could be found.

 

Am I missing an assembly reference or is it another error?

Unity Extended Tracking Issue

November 3, 2014 - 2:06am #2

Hi, 

there seems to be a little error in the documentation;

in fact, you need to cast the tb.Trackable to either an ImageTarget or a CylinderTarget or a MultiTarget (depending on which specific type of target you're working with), so the correct code is:

if (tb.TrackableName.EqualstrackableName )) {
                if (enabled
                    (tb.Trackable as ImageTarget).StartExtendedTracking();
                else
                    (tb.Trackable as ImageTarget).StopExtendedTracking();
                return;
            }

 

Log in or register to post comments