Closed juliohq closed 4 months ago
This actually doesn't work. Perhaps your cursor locking is messing with MouseMotion
events.
https://github.com/Plonq/bevy_rts_camera/assets/7709415/0febf242-d3f1-4a7c-b60f-73884a7690df
This actually doesn't work. Perhaps your cursor locking is messing with
MouseMotion
events.Screen.Recording.2024-04-29.at.19.55.06.mov
That's the intended behavior, the mouse cursor stays in place.
This actually doesn't work. Perhaps your cursor locking is messing with
MouseMotion
events.Screen.Recording.2024-04-29.at.19.55.06.mov
That's the intended behavior, the mouse cursor stays in place.
If you watch the video, you can see the camera actually barely moves, but I'm trying to move it. It's stuck, can't rotate it and can't drag it.
Maybe this is OS dependent.
Note: what I suspect is happening is that manually moving the cursor back to where it started actually triggers MouseMotion events, thus also moving the camera back to where it started. If that's the case, you'll have to find an alternative solution.
I think we can use bevy's built-in CursorGrabMode::Locked
mode until https://github.com/rust-windowing/winit/issues/3094 is solved. As pointed here, the issue is invisible if you just hide the cursor on Windows and Linux, so as long as the locked mode works fine on macOS I think we're fine.
I think we can use bevy's built-in
CursorGrabMode::Locked
mode until rust-windowing/winit#3094 is solved. As pointed here, the issue is invisible if you just hide the cursor on Windows and Linux, so as long as the locked mode works fine on macOS I think we're fine.
Sounds good to me
@Plonq is there anything missing for this PR to be merged?
Apologies! I didn't realise you'd already made that change.
This PR introduces two new variables:
lock_on_rotate
andlock_on_drag
. They are meant to allow the mouse cursor to stay in place while rotating/dragging. The cursor is hidden when performing such actions (soCursorGrabMode::Locked
works fine on Windows and Linux).I've set the default to
false
for bothlock_on_rotate
andlock_on_drag
variables andtrue
. Do you think they should be enabled by default?