Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make clicks on part of model in Vuforia (without Unity)?

I want to make clickable cell of the palette in Vuforia (without Unity) by tap on screen: enter image description here

I found Dominoes example with similar functionality and do that:

  • create one plate object and multiply cells objects

  • call isTapOnSetColor function with parameter x, y (click coordinates) on tap and get coordinates,

  • coordinates is correct, but get the id/name of part of objects is wrong

I think problem with this line:

boolean bool = checkIntersectionLine(matrix44F, lineStart, lineEnd);

In the Dominoes example this was:

bool intersection = checkIntersectionLine(domino->pickingTransform, lineStart, lineEnd);

But I don't know what does do domino->pickingTransform and paste instead of this line modelViewMatrix (Tool.convertPose2GLMatrix(trackableResult.getPose()).getData())

Full code of my touch function: http://pastebin.com/My4CkxHa

Can you help me to make clicks or may be another way (not Unity) to do that?

like image 739
skywind Avatar asked Jan 31 '17 22:01

skywind


1 Answers

Basically, domino->pickingTransform is pretty much the final matrix that is being drawn for each domino object. The domino sample work in a way that for each object (domino), the app checks the projected point of the screen touch and sees if it intersects the matrix of the object. The picking matrix is not exactly the same, since you want to make the is more responsive, so you make it a little wider than the drawing matrix.

You said you are getting a wrong id, but the question is - is it always the same id for different cells? If not, this is probably some small calculation error you made in your matrix transformations. I would suggest to do a visual debugging - add some graphical indication for the detected id, so you will be able to see what cell the application thinks you have clicked. This should help you progress towards the solution.

like image 139
yakobom Avatar answered Oct 18 '22 07:10

yakobom