How to rotate and drag 3D object(ARNode) in Kudan using Gesture Listener in Android

189 Views Asked by At

I have displayed the 3D object on screen using markerless. Now, I want to rotate and move the ARNode on screen using finger gestures?

1

There are 1 best solutions below

0
ND1010_ On

you can use onScroll() event of gestureDetect and change scale of model Node

@Override
    public boolean onScroll(MotionEvent motionEvent, MotionEvent motionEvent1, float v, float v1)
    {

        float x =0;

        if (v > 0)
        {
            x= -Math.abs(v);
            x = (float) (x*0.25);

        }
        else
        {
            x= Math.abs(v);
            x = (float) (x*0.25);

        }

        if (v != 0 && (arbiTrack.getIsTracking()))
        {
            modelNode.rotateByDegrees(x,0,1,0);
            Log.e("canRotate: ",modelNode.getVisible()+"");

        }

        return true;
    }