Move forward in universal camera with right-click

Hey @bestog,

As far as I know, the keysUp property will only work with specifying specific keys on the keyboard so I don’t think you can use that to map forward movement to the right-click. I suspect you may have to make a custom input for the Camera using something like a FreeCameraInputsManager. You can learn more about this here. You might be able to just add an EventListener to the canvas for the “pointerdown” event and use the which properties to determine if the right mouse button is clicked:

canvas.addEventListener("pointerdown", function(e){
        if(e.which == 2 || e.which == 3)
        // Do something
    });

While this may not be the best course of action, it could be a good place to start. It should be noted for the code above that the right mouse button will register as a 2 or 3, depending on the browser that you use.

If I can put together a better solution, I’ll make sure to let you know.

1 Like