Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only horizontal pan with one finger #40

Open
DavidVRG opened this issue Mar 13, 2024 · 4 comments
Open

Only horizontal pan with one finger #40

DavidVRG opened this issue Mar 13, 2024 · 4 comments

Comments

@DavidVRG
Copy link

Can I only move horizontally with one finger?

@TiagoCavalcante
Copy link
Owner

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).

@DavidVRG
Copy link
Author

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.

@DavidVRG
Copy link
Author

Now that I think about it, vertical movement should not be prohibited, but limited.
If it's possible.

@TiagoCavalcante
Copy link
Owner

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants