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); }
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); }