Start a new topic

How to distinguish objects from same wto file

Hi all,


im new to this and i hope my question isnt that dumb. i have built an app and added a wto file with multiple objects to my object tracker. now i need to show specific data to each object when tracked. how can i distinguish the tracked objects? or should i build multiple object tracker while each of them contains a wto file with only 1 object in it and than look wich object tracker is used?!


Thank you in advance,

Regards

David




 Hello David,


Every Object Tracker inside the .wto file has a unique name (this is the name of the video you have created). So in order to address specific augmentations for specific Objects targets, you need to add the name in the code below:

this.objectTrackable = new AR.ObjectTrackable(this.tracker, "put_the_name", {
    drawables: {
        cam: World.drawables
    },
    onObjectRecognized: this.objectRecognized,
    onObjectLost: this.objectLost,
    onError: function(errorMessage) {
        alert(errorMessage);
    }
});

Thanks
Eva

Thanks Eva for that quick answer!


Im sorry to bother again but im still not sure how to make it work. Im working with unity. There i use the Gameobject Object Tracker and gave it the wto file with all my objects. The Trackable inside the Object Tracker holds an Drawable Gameobject wich i want to show for all tracked objects, it contains some texts wich should show different Strings for the different tracked objects, wich already works. I can track them, but i cant distinguish them from each other and im not sure how to implement that code above :/


Thanks for help!

David

Hi, 


The ObjectTrackable also has the OnObjectRecognized event to which you can subscribe to get notified when an object is recognized. The callback is called with an ObjectTarget parameter, which has a Name property that you can use to distinguish between the objects inside a .wto file.


Best regards,

Alexandru

Hi, i have same problem.

where, must i put this code, on my project? i make a new script or there is already script on wikitude plugin?


this.objectTrackable = new AR.ObjectTrackable(this.tracker, "put_the_name", {
    drawables: {
        cam: World.drawables
    },
    onObjectRecognized: this.objectRecognized,
    onObjectLost: this.objectLost,
    onError: function(errorMessage{
        alert(errorMessage);
    }
});


Regards
Riken

Hi, 


Are you using the Unity Plugin or the JS API? The snippet would indicate JS, but the original issue was on Unity. Did you already try our sample projects, which offer plenty of examples and should help you getting started?


Best regards,

Alexandru

Login or Signup to post a comment