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

Implement camera orbiting shortcuts. #51984

Merged
merged 1 commit into from
Oct 16, 2021

Conversation

rcorre
Copy link
Contributor

@rcorre rcorre commented Aug 22, 2021

Fixes godotengine/godot-proposals#2051.
Relates to godotengine/godot-proposals#1215.

Implements shortucts for adjusting the camera rotation in 15-degree
increments, similar to Blender.

I did not add corresponding menu entries for these, as I didn't feel
like they would be too useful from a menu, and didn't want to make the
menu too long.

camera

Fixes godotengine/godot-proposals#2051.
Relates to godotengine/godot-proposals#1215.

Implements shortucts for adjusting the camera rotation in 15-degree
increments, similar to Blender.

I did not add corresponding menu entries for these, as I didn't feel
like they would be too useful from a menu, and didn't want to make the
menu too long.
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally (rebased against latest master), it works as expected.

@akien-mga akien-mga merged commit c240275 into godotengine:master Oct 16, 2021
@akien-mga
Copy link
Member

Thanks!

@Calinou Calinou added the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Oct 16, 2021
@Calinou
Copy link
Member

Calinou commented Oct 16, 2021

This PR can be cherry-picked to 3.x without conflicts. I tested it there as well and it works fine 🙂

I just noticed a minor issue when using the rotation shortcuts (both in master and 3.x). When you rotate the camera upwards or downwards, it can go upside down (which is probably fine). If you perform a full turn this way, the camera will suddenly snap back to its minimum/maximum pitch angle when panning or using freelook. We can fix this by using fmod() when setting the pitch angle, so that the angle actually wraps back to a normally accepted value when making a full turn.

Alternatively, we can clamp the shortcuts to the same pitch angle constraints as panning and freelook – or remove the pitch angle restrictions from panning and freelook, which would match Blender behavior.

@rcorre rcorre deleted the camera_shortcuts branch October 16, 2021 20:46
@rcorre
Copy link
Contributor Author

rcorre commented Oct 17, 2021

I'm on board with godotengine/godot-proposals#1371, but we could add fmod in the meanwhile if we're not sure that would be approved.

I tried testing this on main and while trying to see how the "normal" camera controls behave, I realized that holding MMB/RMB while moving the mouse doesn't seem to do anything in 4.0. Is that a bug?

@Calinou
Copy link
Member

Calinou commented Oct 17, 2021

I realized that holding MMB/RMB while moving the mouse doesn't seem to do anything in 4.0. Is that a bug?

This is caused by #53894. Unfocus and focus the editor window again, and it should work.

@akien-mga
Copy link
Member

Cherry-picked for 3.4.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Oct 18, 2021
@rcorre
Copy link
Contributor Author

rcorre commented Oct 21, 2021

We can fix this by using fmod() when setting the pitch angle, so that the angle actually wraps back to a normally accepted value when making a full turn.

Do we actually want to wrap it, or just have it stop when it hits the min/max angle?

@Calinou
Copy link
Member

Calinou commented Oct 21, 2021

Do we actually want to wrap it, or just have it stop when it hits the min/max angle?

Clamping the value is fine, but wrapping is required if we want to allow the camera to go upside-down when panning or using freelook.

For 3.4, I think we can just clamp the angle value when using the camera orbiting shortcuts. We can investigate what to do with panning and freelook in 3.5 and 4.0.

rcorre added a commit to rcorre/godot that referenced this pull request Nov 9, 2021
This prevents the viewport from going upside-down.

This was suggested at:
godotengine#51984 (comment):

> For 3.4, I think we can just clamp the angle value when using the
> camera orbiting shortcuts. We can investigate what to do with panning
> and freelook in 3.5 and 4.0.
akien-mga pushed a commit to akien-mga/godot that referenced this pull request Nov 15, 2021
This prevents the viewport from going upside-down.

This was suggested at:
godotengine#51984 (comment):

> For 3.4, I think we can just clamp the angle value when using the
> camera orbiting shortcuts. We can investigate what to do with panning
> and freelook in 3.5 and 4.0.

(cherry picked from commit 3bd7c4f)
akien-mga pushed a commit to akien-mga/godot that referenced this pull request Nov 15, 2021
This prevents the viewport from going upside-down.

This was suggested at:
godotengine#51984 (comment):

> For 3.4, I think we can just clamp the angle value when using the
> camera orbiting shortcuts. We can investigate what to do with panning
> and freelook in 3.5 and 4.0.

(cherry picked from commit 3bd7c4f)
lekoder pushed a commit to KoderaSoftwareUnlimited/godot that referenced this pull request Dec 18, 2021
This prevents the viewport from going upside-down.

This was suggested at:
godotengine#51984 (comment):

> For 3.4, I think we can just clamp the angle value when using the
> camera orbiting shortcuts. We can investigate what to do with panning
> and freelook in 3.5 and 4.0.

(cherry picked from commit 3bd7c4f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add numpad 0,2,4,6,8,9 to viewport camera options
4 participants