Hi Eva,
Thank you for the response. Perhaps I'm not seeing correctly but there's no mention of that method 'addImageTargetCamDrawables' on that page. Is it replaced by the 'drawables: { cam : circle }' assignment? If so, how should the new drawable be added when 'onImageRecognized' is fired?
I tried a few different ways, such as 'this.drawables.cam = [circle]', but it didn't work.
Thank you,
Eric
I'm still getting an error that the method is not a function. I'm probably missing something silly but the following doesn't work:
trackable = new AR.ImageTrackable(this.tracker, '*', { onImageRecognized: (target) => { var model = new AR.Model("assets/models/" + target.name + ".wt3"); this.addImageTargetCamDrawables(target, model); }, onImageLost: (target) => { this.removeImageTargetCamDrawables(target); }, onError: (err) => { alert(err); } });
Exact error: 'TypeError: this.addImageTargetCamDrawables is not a function.'
Hi Eva,
Wikitude-cordova-plugin within an Ionic environment.
Thank you,
Eric
Hi Eva,
Sure thing. It's using SDK 7.1.
https://github.com/Wikitude/wikitude-cordova-plugin.git#88861f0
Thank you,
Eric
Hi Eric,
please note that when using javascript arrow functions (=>{}) the scope is limited.
In your case "this" is not the trackable because of this you get the TypeError.
To fix this i would suggest you use anonymous functions instead.
trackable = new AR.ImageTrackable(this.tracker, '*', { onImageRecognized: function(target) { var model = new AR.Model("assets/models/" + target.name + ".wt3"); this.addImageTargetCamDrawables(target, model); }, onImageLost: function(target) { this.removeImageTargetCamDrawables(target); }, onError: function(err) { alert(err); } });
Best Regards,
Alex
Hi Alex,
Ah yes, that works. Knew it was something silly. Thank you much for the help!
Best,
Eric
So it was a false positive. There was a cached version of a different code so it seemed like the fix worked but it didn't. The scoping fix didn't work and it seems like it is because the function addImageTargetCamDrawables isn't part of ImageTrackable as it's supposed to. Here is a screenshot of the debug output and it shows the other expected properties and functions for ImageTrackable except addImageTargetCamDrawables and removeImageTargetCamDrawables.
Hi Eric,
please try your AR-Experience in our cordova sample app to check if the same issue is happening there.
Based on your Screenshot it seems to me that an older version of architect.js(the file including the AR.ImageTrackable) is used.
Best Regards,
Alex
Eric Ong
Looking at the documentation for tracking multiple targets, there are references to this.addImageTargetCamDrawables. However, this function doesn't seem to exist. I tried using AR.ImageTrackable.addImageTargetCamDrawables as well and that doesn't exist either.
https://www.wikitude.com/external/doc/documentation/latest/android/multipletargets.html#multiple-targets
What should be used instead?
Thank you in advance!