Start a new topic
Solved

Instant tracking with freehand drawing. How do I place it?

Hi all,

I'm trying to use the instant tracking to positionate a freehand drawing (made by html canvas). 

I did it but the drawing is not in right position. It is placed at the center of the screen.

How can I translate the canvas coordinates to wikitude coordinates? 


I tried it like this but doens't work. Could you please help me?


//with xpos, ypos --> canvas coordinates


imgDrawable = new AR.HtmlDrawable({html: '<img src="'+canvasImg+'"/>'},1,{

   translate : { 

    x: xpos,

    y: ypos

   }

  });


instantTrackable.drawables.addCamDrawable(imgDrawable);


Sorry if my question is not clear.


Hello Michele,


Based on what you provided it should work so,  could you please send your complete AR experience (.html, .css, .js files, assets, target images) and we can test internally?


Thanks

Eva

Hi Eva, 

Thanks for your quick reply.


In attachment all requested material:

- js file 

- html index

- Main class java

- a pdf file with short description of the problem.


Please let me know if you need more clarifications.


I really hope you can help us.


Thanks in advance

Best Regards

zip

Hi Michelle,



thanks for the detailed information you provided, especially the PDF description, it really conveys what you are trying to do very well.


The origin of the coordinate system when using instant tracking depends on how you initialise the tracking phase; it will most certainly not be on the screen, but somewhere in your scene 3D space. So the position you get from the canvas is not what you want to set. If you want your augmentation to "stick" to a real world object, you need to know it's 3D position with respect to the instant tracking coordinate system. That is something the convertScreenCoordinateToPointCloudCoordinate function can tell you. Its usage is explained here.


Having said that, I don't quite understand why your augmentation is locked to the center of the screen. But I'm quite certain switching the instant tracking state after creating your drawing is certainly not what you want to do. The initialisation phase is a separate process that needs to be handled before creating your augmentations. I recommend using one of our instant tracking sample as a reference.



- Daniel


Hi Michele,

Did you find a solution ?

I am in the same trouble..


1 person likes this
Login or Signup to post a comment