r3f-native-orbitcontrols
r3f-native-orbitcontrols copied to clipboard
Only horizontal pan with one finger
Can I only move horizontally with one finger?
This isn't usually possible in web orbit controls that support touch, because the main action in this type of control is to rotate (the camera around the orbited object).
This could be added though, it'd require some modifications in handleTouchMovePan
, which actually should be abstracted to "forward" the event to the correct "dispatcher" (pan or rotate, or also zoom).
If you are interested in implementing this, I could help explaining some parts of the code (if that'd help).
My idea is to be able to move horizontally in this (pan with one finger):
<Plane args={[200, 200]} position={[0, 0, 0]} rotation={[-Math.PI / 2, 0, 0]}> <meshStandardMaterial attach="material" color="#fcbf49" /> </Plane>
I try a lot of things but not working. I tried to limit how far the pan moves. My biggest problem is that I can go under the Plane and I can also go excessively towards it.
Now that I think about it, vertical movement should not be prohibited, but limited. If it's possible.
@DavidVRG I believe the behavior you want to achieve isn't possible with orbit controls. What you want is map controls.
Look at the following web examples: Map controls Orbit controls
Unfortunately, I don't know any library that implements map controls for native (and any controls which isn't orbit controls).
However, I can, in the future, adapt more types of controls to mobile. But an ideal solution is to make some changes in Drei directly. See this.
Hey @DavidVRG
I have made a pull request to support map controls. #47 should solve the problem. It uses google map like gestures for map controls. Please look into the pull request and see if it fits your use case.