mirror of https://github.com/wayvr-org/wayvr.git
Add space reset to openvr actions (#475)
* Add space reset to openvr actions * remove additional reset state storage
This commit is contained in:
parent
a4115f5e4b
commit
00bc179655
|
|
@ -40,6 +40,7 @@ const PATH_SCROLL: &str = "/actions/default/in/Scroll";
|
|||
const PATH_SHOW_HIDE: &str = "/actions/default/in/ShowHide";
|
||||
const PATH_SPACE_DRAG: &str = "/actions/default/in/SpaceDrag";
|
||||
const PATH_SPACE_ROTATE: &str = "/actions/default/in/SpaceRotate";
|
||||
const PATH_SPACE_RESET: &str = "/actions/default/in/SpaceReset";
|
||||
const PATH_TOGGLE_DASHBOARD: &str = "/actions/default/in/ToggleDashboard";
|
||||
|
||||
const INPUT_ANY: InputValueHandle = InputValueHandle(ovr_overlay::sys::k_ulInvalidInputValueHandle);
|
||||
|
|
@ -55,6 +56,7 @@ pub(super) struct OpenVrInputSource {
|
|||
toggle_dashboard_hnd: ActionHandle,
|
||||
space_drag_hnd: ActionHandle,
|
||||
space_rotate_hnd: ActionHandle,
|
||||
space_reset_hnd: ActionHandle,
|
||||
click_modifier_right_hnd: ActionHandle,
|
||||
click_modifier_middle_hnd: ActionHandle,
|
||||
move_mouse_hnd: ActionHandle,
|
||||
|
|
@ -80,6 +82,7 @@ impl OpenVrInputSource {
|
|||
let toggle_dashboard_hnd = input.get_action_handle(PATH_TOGGLE_DASHBOARD)?;
|
||||
let space_drag_hnd = input.get_action_handle(PATH_SPACE_DRAG)?;
|
||||
let space_rotate_hnd = input.get_action_handle(PATH_SPACE_ROTATE)?;
|
||||
let space_reset_hnd = input.get_action_handle(PATH_SPACE_RESET)?;
|
||||
let click_modifier_right_hnd = input.get_action_handle(PATH_CLICK_MODIFIER_RIGHT)?;
|
||||
let click_modifier_middle_hnd = input.get_action_handle(PATH_CLICK_MODIFIER_MIDDLE)?;
|
||||
let move_mouse_hnd = input.get_action_handle(PATH_MOVE_MOUSE)?;
|
||||
|
|
@ -118,6 +121,7 @@ impl OpenVrInputSource {
|
|||
toggle_dashboard_hnd,
|
||||
space_drag_hnd,
|
||||
space_rotate_hnd,
|
||||
space_reset_hnd,
|
||||
click_modifier_right_hnd,
|
||||
click_modifier_middle_hnd,
|
||||
move_mouse_hnd,
|
||||
|
|
@ -243,6 +247,11 @@ impl OpenVrInputSource {
|
|||
.map(|x| x.0.bState)
|
||||
.unwrap_or(false);
|
||||
|
||||
app_hand.now.space_reset = input
|
||||
.get_digital_action_data(self.space_reset_hnd, hand.input_hnd)
|
||||
.map(|x| x.0.bState)
|
||||
.unwrap_or(false);
|
||||
|
||||
app_hand.now.click_modifier_right = input
|
||||
.get_digital_action_data(self.click_modifier_right_hnd, hand.input_hnd)
|
||||
.map(|x| x.0.bState)
|
||||
|
|
|
|||
|
|
@ -178,6 +178,14 @@ impl PlayspaceMover {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (_, pointer) in app.input_state.pointers.iter().enumerate() {
|
||||
if pointer.now.space_reset && !pointer.before.space_reset {
|
||||
self.reset_offset(chaperone_mgr, &app.input_state);
|
||||
log::info!("Space reset");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reset_offset(&mut self, chaperone_mgr: &mut ChaperoneSetupManager, input: &InputState) {
|
||||
|
|
|
|||
|
|
@ -50,6 +50,11 @@
|
|||
"type": "boolean",
|
||||
"requirement": "optional"
|
||||
},
|
||||
{
|
||||
"name": "/actions/default/in/SpaceReset",
|
||||
"type": "boolean",
|
||||
"requirement": "optional"
|
||||
},
|
||||
{
|
||||
"name": "/actions/default/in/LeftHand",
|
||||
"type": "pose",
|
||||
|
|
|
|||
Loading…
Reference in New Issue