Hi,
To get the distance to an image target you can call ImageTarget.ComputeDistanceToImageTarget:
This only works correctly if you have set the physical target height for the target you are using in the wtc file to the correct value.
You can get the currently recognized image target from the OnImageRecongized callback on the ImageTrackable. Here is the documentation for the ImageTrackable:
as well as documentation on how add the callback:
Also from the ImageTarget you can get the name of the currently recognized target. So if you register the following method as a callback to the OnImageRecognized event (as mentioned above), you can add different GameObjects based on the target name. The GameObjects should be added as children to the ImageTrackable
public void OnImageRecognized(ImageTarget target) { if (target.Name == "TargetA") { // Create GameObject with target A image and set it as a child to the ImageTrackable } else if (target.Name == "TargetB") { // Create GameObject with target B image and set it as a child to the ImageTrackable } }
Best regards,
Alexandru
Fatima Alhammadi
Dear Wikitude support team,
May you please help me how to know the detection distance based on the physical height of an object (i.e. if i use an ImageTraker Targetable =110mm, how to know the suitable distance to detect it ??)
Another question is that, if within my Target collection i have two targets A and B. If A is detected i want to display and image, however if B is detected i would like to display another image. Can you please asset with a C# line code to determine the name of the taget in order to be compared (i.e. code algorithm:
if(target ==A) then
show related imageA
else if (target ==A)
show related image B
Your help would be highly appreciated,