Log in or register to post comments

handle touches on 3d object (domino)

January 24, 2017 - 2:35pm #1

Hello 

Tell me please 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 touch on 3d

 

I think that domino->pickingTransform is modelViewMatrix after rotation, isnt it?

my app havent any rotation and I need to detect touches in the same state of the object

handle touches on 3d object (domino)

January 28, 2017 - 2:14pm #2

any ideas please

Log in or register to post comments