[bevy_camera_controller] Implement customisable rotation system for camera movement#22461
Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
…reecamera_controller function
|
Hi, I think I have resolved all my issues but CI is still failing. The error is from another crate. Can I do something on my end or do I have to wait til it's fixed in the main branch? |
|
Thanks for fixing the main branch. CI is now successful. What's the normal way now? |
|
Now we need to find two contributors to review and approve this PR :) I'll ask around! |
|
It looks like your PR is a breaking change, but you didn't provide a migration guide. Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes. |
|
I'm generally skeptical of adding significant configurability and complexity to these dev-tool cameras. These tools are intended as very simple dev-mode cameras with a limited scope: they should be easy to replace for users / projects that want different behavior. That said, fixes like:
are welcome improvements though, and I would be very happy to review (and likely merge) them in their own PRs. |
Objective
FreeCameracontroller.Solution
RotationSystemenum: Added a configuration option to choose between two movement modes:YawPitchRoll(Default): Movement is relative to the camera's full orientation. Looking up and moving forward moves you "up" in world space.Yaw: Movement is constrained to the horizontal plane. Moving forward always keeps you at the same elevation, regardless of where the camera is looking.run_freecamera_controllerto use a rotation-based translation instead of manually calculating forward/right vectors.key_forwardmoves the camera along-Zandkey_backmoves it along+Z, aligning with standard right-handed coordinate systems used in Bevy.Testing
RotationSystemmodes in a local scene.Yawmode, looking straight down and pressing "Forward" moves the camera horizontally.YawPitchRollmode, looking straight down and pressing "Forward" moves the camera towards the ground.FreeCameracomponent to a camera or use thefree_camera_controllerexamplerotation_systembetweenRotationSystem::YawandRotationSystem::YawPitchRollin the component initialization or via an inspector.Wmoves you forward andSmoves you backward.Showcase
This PR adds a new configuration option to the
FreeCameracomponent to control movement behavior.Click to view usage example