[Solved]Using camera with just one mouse button

Hi, i have a question is it possible to move the camera in every possible way(move, rotate and zoom) but with just the right button of the mouse? I thought to implement something like a radio button from wich you can chose to move rotate or zoom the camera but i don’t know to write the code for the camera to block the other movement and use only the right button of the mouse.
Can someone help me? Tnx

OrbitControls provides the following functionality: setting actions for specific mouse buttons (.mouseButton) and enabling only specific actions (.enablePan, .enableRotate and .enableZoom). These things can be combined.

function restrictOrbitControls( action )
{
    controls.mouseButtons = {
        LEFT: null,
        MIDDLE: null,
        RIGHT: action
    }
    controls.enablePan = (action === THREE.MOUSE.PAN);
    controls.enableZoom = (action === THREE.MOUSE.DOLLY);
    controls.enableRotate = (action === THREE.MOUSE.ROTATE);
}

Click on the image to try it:

image

2 Likes

thank you so much man, you saved me :heart: :heart: :heart: :heart:

1 Like