Start a new topic

Get onClick offset to target

Get onClick offset to target


Hey guys,

I started to work on a AR App project with wikitude.

Now I want to know if it's possible to spawn and target a label or HTMLDrawable by clicking on the camera image.

I tried to fetch the onClick event over a div overlay. This works good and I can spawn labels and stuff, but with the wrong distance to the tracker. This is based on different measurements: with the overlay, I can get the absolute offset to the phone display and the labels are based on the relative offset to the target.

So my question is: Is it possible to get the offsets relative to the target via onClick?

 

Kind regards

Mirko

Hi Mirko,

 

my apologies for the delayed replay. Maybe this is what you are looking for:

 

this.video = new AR.VideoDrawable("assets/video.mp4", 0.5, {

    offsetX: 0.123,

    offsetY: 0.456,

    onClick: function videoClicked() {

        console.log(this.offsetX);

        console.log(this.offsetY);

    }

});

 

 

Output:

0.123

0.456

 

 

I just used an AR.VideoDrawable since I conveniently had the code at hand. This should work with the other drawables as well.

 

 

Kind regards

Daniel

 

 
Login or Signup to post a comment