Start a new topic

distance between targets

I am using distance between targets feature of Xamarin wikitude sdk v7.

While calculating the distance between 2 targets I am getting target name correctly but distance as 0. 

Please provide me with the solution.


Good morning,



did you provide physical heights for your image targets? You can do so either by specifying them when creating the wt3 file or by setting them explicitly in the JavaScript code. The unit is millimeters.


Here's an excerpt from the "Distance Between Targets" sample doing the latter:

  

var targetCollectionResource = new AR.TargetCollectionResource("assets/dinosaurs.wtc");

var tracker = new AR.ImageTracker(targetCollectionResource, {
    maximumNumberOfConcurrentlyTrackableTargets: 5,
    extendedRangeRecognition: AR.CONST.IMAGE_RECOGNITION_RANGE_EXTENSION.OFF,
    onDistanceChangedThreshold: 0,
    physicalTargetImageHeights: { // the physical target image height is required to get the correct distance between targets
        diplodocus: 82,
        spinosaurus: 82,
        triceratops: 82,
        tyrannosaurus: 82
    },
    onTargetsLoaded: this.worldLoaded,
    onError: function (errorMessage) {
        alert(errorMessage);
    }
});

  


- Daniel

waiting for your response.....!!!

Login or Signup to post a comment