primary pointer is the one that was last clicked
This commit is contained in:
@@ -87,6 +87,10 @@ impl InputState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if hand.now.click {
|
||||||
|
hand.last_click = Instant::now();
|
||||||
|
}
|
||||||
|
|
||||||
if hand.now.click_modifier_right {
|
if hand.now.click_modifier_right {
|
||||||
hand.interaction.mode = PointerMode::Right;
|
hand.interaction.mode = PointerMode::Right;
|
||||||
continue;
|
continue;
|
||||||
@@ -157,6 +161,7 @@ pub struct Pointer {
|
|||||||
pub pose: Affine3A,
|
pub pose: Affine3A,
|
||||||
pub now: PointerState,
|
pub now: PointerState,
|
||||||
pub before: PointerState,
|
pub before: PointerState,
|
||||||
|
pub last_click: Instant,
|
||||||
pub(super) interaction: InteractionState,
|
pub(super) interaction: InteractionState,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,6 +173,7 @@ impl Pointer {
|
|||||||
pose: Affine3A::IDENTITY,
|
pose: Affine3A::IDENTITY,
|
||||||
now: Default::default(),
|
now: Default::default(),
|
||||||
before: Default::default(),
|
before: Default::default(),
|
||||||
|
last_click: Instant::now(),
|
||||||
interaction: Default::default(),
|
interaction: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,10 +255,15 @@ pub fn interact<O>(
|
|||||||
where
|
where
|
||||||
O: Default,
|
O: Default,
|
||||||
{
|
{
|
||||||
[
|
if app.input_state.pointers[1].last_click > app.input_state.pointers[0].last_click {
|
||||||
interact_hand(0, overlays, app),
|
let right = interact_hand(1, overlays, app);
|
||||||
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<O>(
|
fn interact_hand<O>(
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use std::thread::sleep;
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
use glam::{Affine3A, Vec3, Vec3A, Vec4};
|
use glam::{Affine3A, Vec3, Vec3A, Vec4};
|
||||||
use idmap::IdMap;
|
use idmap::IdMap;
|
||||||
@@ -81,6 +83,8 @@ impl LinePool {
|
|||||||
};
|
};
|
||||||
data.data.sort_order = 69;
|
data.data.sort_order = 69;
|
||||||
|
|
||||||
|
sleep(Duration::from_millis(50));
|
||||||
|
|
||||||
data.initialize(overlay, app);
|
data.initialize(overlay, app);
|
||||||
data.upload_texture(overlay, &app.graphics);
|
data.upload_texture(overlay, &app.graphics);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user