Start a new topic
Solved

loaded instant tracker tracks but doesn't show the drawables

Hello,

I'm building on top of the save/load instant target example (android javascript sdk) to save and load multiple targets. I was able to save in different wto and json files, Then I was able to load using two arrays, one of instantTracker and one of associated instantTrackable.


For now, I'm only loading one instant tracker to test. When pointing the camera to the scene I can see that the tracking is started but the drawables don't appear.

The following are the result of:

 1. AR.logger.debug(JSON.stringify(instantTrackers[0]));

{
   "__id":3,
   "__smartEnabled":false,
   "state":0,
   "canStartTracking":true,
   "enabled":true,
   "deviceHeight":1,
   "trackingPlaneOrientation":0
}

 2. AR.logger.debug(JSON.stringify(instantTrackables[0]));

 

{
   "destroyed":false,
   "drawables":{
      "cam":[
         {
            "destroyed":false,
            "enabled":true,
            "mirrored":true,
            "rotatesToCamera":true,
            "rotate":{
               "x":0,
               "y":0,
               "z":0,
               "global":{
                  "x":0,
                  "y":0,
                  "z":0
               }
            },
            "translate":{
               "x":0,
               "y":0,
               "z":0,
               "global":{
                  "x":0,
                  "y":0,
                  "z":0
               }
            },
            "scale":{
               "x":1,
               "y":1,
               "z":1
            },
            "opacity":1,
            "horizontalAnchor":1,
            "verticalAnchor":4,
            "zOrder":0,
            "imageResource":{
               "destroyed":false,
               "__id":1
            },
            "height":1,
            "__id":2
         },
         {
            "__id":6,
            "destroyed":false,
            "enabled":true,
            "mirrored":true,
            "rotatesToCamera":false,
            "rotate":{
               "x":0,
               "y":0,
               "z":346.022,
               "global":{
                  "x":0,
                  "y":0,
                  "z":0
               }
            },
            "translate":{
               "x":-0.005596538539975882,
               "y":-0.04163557291030884,
               "z":0,
               "global":{
                  "x":0,
                  "y":0,
                  "z":0
               }
            },
            "scale":{
               "x":0.02384253,
               "y":0.02384253,
               "z":0.02384253
            },
            "uri":"assets/models/clock.wt3"
         },
         {
            "__id":7,
            "destroyed":false,
            "enabled":true,
            "mirrored":true,
            "rotatesToCamera":false,
            "rotate":{
               "x":0,
               "y":0,
               "z":350.1976103,
               "global":{
                  "x":0,
                  "y":0,
                  "z":0
               }
            },
            "translate":{
               "x":0.22446542978286743,
               "y":-0.18008607625961304,
               "z":0,
               "global":{
                  "x":0,
                  "y":0,
                  "z":0
               }
            },
            "scale":{
               "x":0.03003004111716,
               "y":0.03003004111716,
               "z":0.03003004111716
            },
            "uri":"assets/models/clock.wt3"
         }
      ],
      "radar":[

      ],
      "indicator":[

      ],
      "initialization":[

      ]
   },
   "enabled":true,
   "renderingOrder":0,
   "__id":4,
   "tracker":{
      "__id":3,
      "__smartEnabled":false,
      "state":0,
      "canStartTracking":true,
      "enabled":true,
      "deviceHeight":1,
      "trackingPlaneOrientation":0
   },
   "snapToScreen":{
      "enabled":false,
      "enableDelayed":-1,
      "enabledOnExitFieldOfVision":false,
      "snapContainer":null,
      "onSnappedToScreen":null,
      "onDelayedSnapInterruption":null,
      "resolvedBoundingBox":{
         "id":"",
         "right":0,
         "top":0,
         "left":0,
         "bottom":0
      }
   }
}


 Any ideas what may be causing this problem?

Thanks! 

1 Comment

The problem was caused by an asynchronous call. World.init() starts before the arrays are filled. Solved the issue. 

Login or Signup to post a comment