Skip to content

Conversation

@inaridarkfox4231
Copy link
Contributor

@inaridarkfox4231 inaridarkfox4231 commented Apr 22, 2023

Resolves #6107

Changes:

Currently, the orbitControl() method for moving the camera with the right mouse button only allows movement parallel to the XZ plane.

However, in software such as blender, parallel movement of the camera is implemented by movement within the plane perpendicular to the line of sight. So I wanted to do it that way.

This moves the center position of the appearance according to the movement of the mouse. Intuitive operation is possible by shifting the viewpoint in the opposite direction to the operation direction, like a map application.

It's also true that the movement distance depends on the actual value of the mouse movement distance, so it has a similar problem to mouse scrolling, where it moves too much at small scales. In order to solve this problem, I thought it would be natural to move the mouse along with the movement of the mouse.

Screenshots of the change:

sample code: improve panning Demo

2023-04-23.03-03-26.mp4

PR Checklist

So far the right mouse button translates the camera only parallel to the XZ plane, so let's rewrite it to cover the distance traveled along the mouse movement.
This allows you to achieve the same behavior regardless of scale.
We will prepare a new function to obtain the result of applying it to a vector when a square matrix of order 4 is regarded as a matrix in the shader.
This is because some of these are used in the camera translation method when doing orbitControl().
Minor fixes for indentation, extra spaces and character counts
Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! In addition to the more natural camera movement, having matrix-vector multiplication natively in the library is a great bonus 🙂

@davepagurek davepagurek merged commit 14e9b51 into processing:main Apr 23, 2023
@inaridarkfox4231 inaridarkfox4231 deleted the improve-cameraMove branch April 23, 2023 15:59
@inaridarkfox4231
Copy link
Contributor Author

Thanks for merge! ('ω') It was my first time adding a method, but it was fun!

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

Successfully merging this pull request may close these issues.

I want to improve the method of orbitControl () that translates the camera

2 participants