yomotsu / camera-controls

A camera control for three.js, similar to THREE.OrbitControls yet supports smooth transitions and more features.

Home Page:https://yomotsu.github.io/camera-controls/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to set the mousewheel rotation direction?

mokargas opened this issue · comments

commented

Hey there

I'm trying to create an orbiting camera controlled by the scrollwheel on the mouse. If I change the mouse input configuration to use the scrollwheel, the direction is up and down. I'd like it to be rotating in the horizontal axis, like the standard method of using drag.

How can I do this?

I'm using Drei's wrapper

    <CameraControls
        enabled={cameraEnabled}
        camera={cameraRef.current}
        mouseButtons={{
          right: control.ACTION.NONE,
          left: control.ACTION.NONE,
          middle: control.ACTION.NONE,
          wheel: control.ACTION.ROTATE
        }}
        setTarget={target}
      />```

It works on my macOS trackpad.
Your mouse might not emit horizontal value
Here is the code
https://github.com/yomotsu/camera-controls/blob/cee042753169f3bbeb593833ce92d70d52b6862f/src/CameraControls.ts#L892C5-L892C5

commented

I think you're right. I'm on PC.

I noticed if I use an advanced mouse (like the MX Master 3) which has an additional horizontal scroll-wheel, then it works fine.

However I think most users will only have a vertical single scrollwheel on a standard mouse.

Thanks for understanding.
As long as the mouse does not have the feature, I think we can't detect horizontal wheel movement...
Therefore, the answer to this issue is: it depends on the mouse device...

Closing due to lack of feedback.