The handle touches the Dominoes Vuforia 3d object

I am using vuforia with a Dominoes sample

Please tell me what is domino-> pickingTransform in

Vuforia::Vec3F intersection, lineStart, lineEnd; projectScreenPointToPlane(Vuforia::Vec2F(touch1.tapX, touch1.tapY), Vuforia::Vec3F(0, 0, 0), Vuforia::Vec3F(0, 0, 1), intersection, lineStart, lineEnd); Domino* domino; Domino* selected = NULL; float dist; // For each domino, check for intersection with our picking line for (int i = 0; i < dominoCount; i++) { domino = &dominoArray[i]; bool intersection = checkIntersectionLine(domino->pickingTransform, lineStart, lineEnd); if (intersection) { selected = domino; selectedDominoIndex = i; break; } } 

I replaced domino-> pickingTransform with matrix44F (modelViewMatrix)

 intersection = SampleMath.getPointToPlaneIntersection( SampleMath.Matrix44FInverse(vuforiaAppSession.getProjectionMatrix()), matrix44F, metrics.widthPixels, metrics.heightPixels, new Vec2F(x, y), new Vec3F(0, 0, 0), new Vec3F(0, 0, 1)); lineStart = SampleMath.getPointToPlaneLineStart( SampleMath.Matrix44FInverse(vuforiaAppSession.getProjectionMatrix()), matrix44F, metrics.widthPixels, metrics.heightPixels, new Vec2F(x, y), new Vec3F(0, 0, 0), new Vec3F(0, 0, 1)); lineEnd = SampleMath.getPointToPlaneLineEnd( SampleMath.Matrix44FInverse(vuforiaAppSession.getProjectionMatrix()), matrix44F, metrics.widthPixels, metrics.heightPixels, new Vec2F(x, y), new Vec3F(0, 0, 0), new Vec3F(0, 0, 1)); boolean bool = checkIntersectionLine(matrix44F, lineStart, lineEnd); 

but now the application does not detect 3d touch

I think domino-> pickingTransform is modelViewMatrix after rotation, right?

my application has no rotation, and I need to detect touches in the same state of the object

+5
source share
1 answer

domino->pickingTransform is pretty much the final matrix that is drawn for each domino object. The domino pattern works in such a way that for each object (domino) the application checks the projected touch point of the screen and sees if it intersects the matrix of the object. The selection matrix is โ€‹โ€‹not exactly the same, since you want to make the sensory response more responsive, so you make it a little wider than the drawing matrix.

It's hard to understand what exactly you replaced it with, but it should be a pretty similar matrix (of course, 4X4) to the one with which you draw each of your objects.

+3
source

Source: https://habr.com/ru/post/1263290/


All Articles