Hi,
This sounds more like a standard javascript implementation question that something related to the Wikitude SDK as such and its features. Did you make sure to debug the code to see what exactly is happening in the code? Also please make sure to check ObjectTrackable class and general documentation to make sure that the concepts are clear.
Thx and greetings
Nicola
Hi,
new AR.ObjectTrackable(..., { drawables: { cam: temp } });
just initializes the trackable with your original label. For the change to happen you will need to re-set the cam drawables. Even though the temp variable might change on the JavaScript side, the Wikitude SDK needs to be informed of that change, it will not pick up on this automatically.
this.objectTrackable.drawables.cam = [temp];
Here's the corresponding API reference.
- Daniel
Hi,
are you sure your onObjectRecognized callback is invoked? It seems to me what you're trying to do is correct. Have you tried using the drawables.addCamDrawable and drawables.removeCamDrawable functions? If that does not work either, would you mind trying the exact same thing with image tracking instead?
- Daniel
Its working now! I had to write World.objectTrackable.drawables.cam instead of this.objectTrackable.drawables.cam. Thanks for the support :)
Nilotpal Biswas
I am using the following code for showing label for an recognised object.
var temp=new AR.Label("chair",0.2,{offsetY:-0.25,style:{textColor:'#00C100',backgroundColor:'#FFFFFF80'}});
this.objectTrackable = new AR.ObjectTrackable(this.tracker, "*", {
onObjectRecognized: function(targetName) {
temp=new AR.Label(targetName,0.2,{offsetY:-0.25,style:{textColor:'#00C100',backgroundColor:'#FFFFFF80'}});
World.hideInfoBar();
},
drawables: {
cam: temp
},
onError: World.onError
});
},
But the label is not getting changed once its recognised. How to do this?