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

Moving the model should work without a focus point #678

Closed
hannobraun opened this issue Jun 10, 2022 · 0 comments · Fixed by #806
Closed

Moving the model should work without a focus point #678

hannobraun opened this issue Jun 10, 2022 · 0 comments · Fixed by #806
Labels
good first issue Good for newcomers type: feature New features and improvements to existing features

Comments

@hannobraun
Copy link
Owner

Fornjot's input/graphics code has the concept of a focus point: the point where the mouse cursor touches the model. This focus point is used to process input: If you rotate the model (move the mouse while pressing the left mouse button) while the mouse hovers over it, the model will be rotated around the focus point. When moving the model (move the mouse while pressing the right mouse button), the model is moved such, that the same point always stays under the mouse cursor, making the movement feel very natural.

Unfortunately, moving the model only works, if the mouse is touching the model (i.e. if there is a focus point). This can be quite confusing, if you want to move the model, but aren't currently touching it with the mouse (either by accident, or because you don't know that you need to touch it).

Moving the model should always work. If there is no focus point, a fallback should be used. This has already been done for rotation, and it would make sense to make sure that both moving and rotation use the same mechanism to compute the fallback point (making sure they are always in sync). I believe that rotation is currently using the coordinate system origin (0/0/0) as the fallback point, which is not ideal. I think it would be better, to use the center point of the models bounding volume.

All input code lives in fj-viewer. The movement code lives in movement.rs. The rotation code lives in rotation.rs. The FocusPoint struct is defined in camera.rs. Maybe it makes sense to just replace the FocusPoint struct with a regular Point<3>, and set it to the fallback value, if necessary, right where it is computed in camera.rs.

I'm labeling this as https://github.com/hannobraun/Fornjot/labels/good%20first%20issue, as this issue is focused on input code only, and doesn't require much specific knowledge of Fornjot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type: feature New features and improvements to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant