Example #1
0
    public void setCounterByIncrement(int direction)
    {
        // update the active tracker that is dynamically defined
        TrackableBehaviour activeTracker = VuforiaCustom.getActiveTracker();

        if (activeTracker == null)
        {
            Debug.LogError("no active trackers found in the scene");
            return;
        }

        // get the current counter value
        //Debug.Log(activeTracker);
        //Debug.Log(activeTracker.gameObject);
        ModelModification mm = activeTracker.gameObject.GetComponent <ModelModification>();
        int counter          = mm.getCounter();

        Debug.Log("1 counter before change: " + counter);

        // identify direction (left or right)
        if (direction > 0)
        {
            counter++;
        }
        else if (direction < 0)
        {
            counter--;
        }

        Debug.Log("2 counter after change: " + counter);
        mm.setCounter(counter);
    }
Example #2
0
    public void setCounterByInt(int newCount)
    {
        // update the active tracker that is dynamically defined
        TrackableBehaviour activeTracker = VuforiaCustom.getActiveTracker();

        if (activeTracker == null)
        {
            Debug.LogError("no active trackers found in the scene");
            return;
        }

        // set the new counter value to the currently tracked target
        ModelModification mm = activeTracker.gameObject.GetComponent <ModelModification>();

        Debug.Log("changing counter from " + mm.getCounter() + " to " + newCount);
        mm.setCounter(newCount);
    }
        private void OnTrackingFound()
        {
            Renderer[] rendererComponents = GetComponentsInChildren <Renderer>(true);
            Collider[] colliderComponents = GetComponentsInChildren <Collider>(true);

            // Enable rendering:
            foreach (Renderer component in rendererComponents)
            {
                component.enabled = true;
            }

            // Enable colliders:
            foreach (Collider component in colliderComponents)
            {
                component.enabled = true;
            }

            // set value in dropdown to show the same as current model shown
            ModelModification mm = gameObject.GetComponent <ModelModification>();

            mm.updateDropdownMenu();

            Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found");
        }