steveOw
steveOw

Reputation: 1046

THREE.js move Orthographic camera up and down without changing camera orientation

I am using Orthographic camera with OrbitControls and it works fine for zooming in and out (with mouse scrollwheel) and panning left and right (holding mouse right button down).

But I would also like to be able to "pan" the camera up & down (I believe the technical term is "boom" or "jib").

OrbitControls doesn't provide this motion.

What can I do to drive such a vertical motion from the mouse?

Upvotes: 1

Views: 892

Answers (1)

M -
M -

Reputation: 28462

You can set which mouse buttons perform which action with OrbitControls.mouseButtons. It sounds like you already have rotating and dolly (AKA zoom in/out), but you still need to set the desired pan (up/down/left/right) button.

controls.mouseButtons = {
    LEFT: THREE.MOUSE.ROTATE,
    MIDDLE: THREE.MOUSE.DOLLY,
    RIGHT: THREE.MOUSE.PAN
}

Don't forget to also set the .screenSpacePanning property to either true or false, depending on what your desired behavior is. My guess is you want it set to true, but play with it to get the desired result.

Upvotes: 3

Related Questions