Start a new topic

in MultipleTargets DistanceBetweenTargets how can i get the distance between the user and target?

in JS examples MultipleTargets DistanceBetweenTargets how can i get the distance between the user and every marker/target?


i am making AR DJ app like this one https://www.youtube.com/watch?v=_rJS1p9LM18


Hi,


the JS API offers two distances you can query:


  • distance between targets
  • distance between phone and target

The former you seem to have found already in the corresponding sample, for the latter we happen to have a sample as well. It is called 'DistanceToTarget'. Here is the corresponding reference page, here the documentation page.

 

var pageOne = new AR.ImageTrackable(this.tracker, "*", {
	drawables: {
		cam: [...]
	},
	distanceToTarget: {
		changedThreshold: 1,
		onDistanceChanged: function(distance) {
			alert(distance); // distance from phone to target
		}
	}
});

 

Both distances require a physical image target height to be provided.



- Daniel




1 person likes this

Thank you Daniel :D  

Hello,

sorry but i have another question which license should i get for it, what is it considered as [2D Image Recognition or 3D Engine or Instant Tracking (SLAM) or Object Recognition or Cloud Recognition]


i just need the MultipleTargets and the distance


thanks.

Good morning,



a SDK Pro license is all you need for that. That gives you multiple targets as well as the distance to and between targets. 



- Daniel


Hi,

How can we get distance between two targets? not distance between the phone and the target.

Thanks

Hi,

How can we get distance between two targets? not distance between the phone and the target.

Thanks

Good morning,



here's the relevant documentation, and here is some sample code of the feature.


new AR.ImageTrackable(tracker, "*", {

    onImageRecognized: function (target) {

        var distance = target.getDistanceTo(some_other_target);

    }

});


The SDK sample app (with the exception of Xamarin) contains a sample dedicated to this feature that demonstrates its usage in detail.



- Daniel



1 person likes this
Login or Signup to post a comment