diff --git a/src/backend/input.rs b/src/backend/input.rs index b7e7c12..5cb6fa8 100644 --- a/src/backend/input.rs +++ b/src/backend/input.rs @@ -87,6 +87,10 @@ impl InputState { } } + if hand.now.click { + hand.last_click = Instant::now(); + } + if hand.now.click_modifier_right { hand.interaction.mode = PointerMode::Right; continue; @@ -157,6 +161,7 @@ pub struct Pointer { pub pose: Affine3A, pub now: PointerState, pub before: PointerState, + pub last_click: Instant, pub(super) interaction: InteractionState, } @@ -168,6 +173,7 @@ impl Pointer { pose: Affine3A::IDENTITY, now: Default::default(), before: Default::default(), + last_click: Instant::now(), interaction: Default::default(), } } @@ -249,10 +255,15 @@ pub fn interact( where O: Default, { - [ - interact_hand(0, overlays, app), - interact_hand(1, overlays, app), - ] + if app.input_state.pointers[1].last_click > app.input_state.pointers[0].last_click { + let right = interact_hand(1, overlays, app); + let left = interact_hand(0, overlays, app); + [left, right] + } else { + let left = interact_hand(0, overlays, app); + let right = interact_hand(1, overlays, app); + [left, right] + } } fn interact_hand( diff --git a/src/backend/openvr/lines.rs b/src/backend/openvr/lines.rs index 5f50521..fe79c27 100644 --- a/src/backend/openvr/lines.rs +++ b/src/backend/openvr/lines.rs @@ -1,6 +1,8 @@ use std::f32::consts::PI; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; +use std::thread::sleep; +use std::time::Duration; use glam::{Affine3A, Vec3, Vec3A, Vec4}; use idmap::IdMap; @@ -81,6 +83,8 @@ impl LinePool { }; data.data.sort_order = 69; + sleep(Duration::from_millis(50)); + data.initialize(overlay, app); data.upload_texture(overlay, &app.graphics);