bevy_4x_camera icon indicating copy to clipboard operation
bevy_4x_camera copied to clipboard

Camera strange behavior

Open VRichardJP opened this issue 3 years ago • 1 comments

Hi,

I have observed some strange camera behavior with the current version, it can be reproduced with the board.rs example:

  • [ ] when the mouse is used to rotate (right click) at the same time the keyboard is used to translate (in any direction), the camera translation is way faster than expected. By default the move_sensitivity of the keyboard is quite low so it is difficult to see the issue, but if it is set to a higher value (for example (2.0, 0.4)) the problem becomes quite obvious. Interestingly, there is no issue when keyboard is used both to translate and rotate at the same time
  • [ ] the zoom is not "straight" but always focuses on a point around the bottom left of the window
  • [ ] It took me a while to realize that I actually control the camera rig and not the camera itself. Unfortunately, if the camera and its rig are not oriented the same, the controls are totally "messed up". I think it would be nice to warn about this behavior

VRichardJP avatar Jun 18 '21 02:06 VRichardJP

the zoom issue can be easily fixed with:

diff --git a/src/lib.rs b/src/lib.rs
index 97e8fcb..3e116c2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -251,7 +251,7 @@ fn camera_rig_movement(
                 // Camera Mouse Zoom
                 for event in mouse_wheel_events.iter() {
                     move_to_camera.translation -=
-                        move_to_camera * Vec3::ONE * event.y * rig.mouse.zoom_sensitivity;
+                        move_to_camera * Vec3::Z * event.y * rig.mouse.zoom_sensitivity;
                 }
 
                 // Camera Mouse Rotate

VRichardJP avatar Jun 18 '21 04:06 VRichardJP