Start a new topic

Wikitude 7.1 ARKit Beta - Can't place model immediately after tracking starts

I'm seeing this issue on the new javascript 7.1 beta but only when ARKit is NOT enabled

If I attempt to place a model immediately after transitioning the InstantTracker to the tracking state 

1) When arKitCoreEnabled is true the model will show up

2) When arKitCoreEnabled is not set the model will not show up 

I've modified at attached the '3d Model on Place' example to demonstrate. I just added a World.addModel call in the changeTrackerStateFn

changeTrackerState: function changeTrackerStateFn() {

        if (this.tracker.state === AR.InstantTrackerState.INITIALIZING) {

            document.getElementById("tracking-start-stop-button").src = "assets/buttons/stop.png";

            document.getElementById("tracking-height-slider-container").style.visibility = "hidden";

            this.tracker.state = AR.InstantTrackerState.TRACKING;

            World.addModel(0, 0);

        } else {





My assumption regarding this issue is, that, when the model is being added in your code, the internal state of the tracker has not yet changed. Which is why the Wold.addModel function's check for World.isTracking() fails and skips its entire body.

The state change of the tracker has an asynchronous nature, which is why it is required to wait for the onChangedSate callback. The circumstance that the ARKit implementation is ready in time while the Wikitude implementation is not is mere coincidence and should not be relied on.

To be perfectly clear:

this.tracker.state = AR.InstantTrackerState.TRACKING;

if (this.tracker.state == AR.InstantTrackerState.TRACKING) {

  // not necessarily true

  // need to wait for onChangedSate


At least that is my current interpretation of the issue. I have not run any tests yet.

- Daniel

Thanks for clarifying the behavior of the state change Daniel! I guess we've just been getting lucky in the past. Deferring model placement until the callback from onChangedState fixes the issue.


Login or Signup to post a comment