og-openxr-repo #1
@@ -566,8 +566,8 @@ fn move_kneeboard(
|
|||||||
let rot_offset: Quat = Quat::from_axis_angle(Vec3::new(1.0, 0.0, 0.0), FRAC_PI_2)
|
let rot_offset: Quat = Quat::from_axis_angle(Vec3::new(1.0, 0.0, 0.0), FRAC_PI_2)
|
||||||
* Quat::from_axis_angle(Vec3::new(0.0, 0.0, 1.0), PI);
|
* Quat::from_axis_angle(Vec3::new(0.0, 0.0, 1.0), PI);
|
||||||
|
|
||||||
if let Ok(trigger_state) = left.squeeze_click.state(&session, Path::NULL)
|
if let Ok(trigger_state) = left.squeeze.state(&session, Path::NULL)
|
||||||
&& trigger_state.current_state
|
&& trigger_state.current_state >= 1.0
|
||||||
{
|
{
|
||||||
let Ok(transform) = left_transform.single() else {
|
let Ok(transform) = left_transform.single() else {
|
||||||
return;
|
return;
|
||||||
@@ -578,8 +578,8 @@ fn move_kneeboard(
|
|||||||
kneeboard.rotation = transform.rotation * rot_offset;
|
kneeboard.rotation = transform.rotation * rot_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Ok(trigger_state) = right.squeeze_click.state(&session, Path::NULL)
|
if let Ok(trigger_state) = right.squeeze.state(&session, Path::NULL)
|
||||||
&& trigger_state.current_state
|
&& trigger_state.current_state >= 1.0
|
||||||
{
|
{
|
||||||
let Ok(transform) = right_transform.single() else {
|
let Ok(transform) = right_transform.single() else {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ pub struct LeftControllerActions {
|
|||||||
pose: Action<Posef>,
|
pose: Action<Posef>,
|
||||||
pub thumbstick: Action<Vector2f>,
|
pub thumbstick: Action<Vector2f>,
|
||||||
pub trigger: Action<f32>,
|
pub trigger: Action<f32>,
|
||||||
pub trigger_click: Action<bool>,
|
// pub trigger_click: Action<bool>,
|
||||||
pub squeeze: Action<f32>,
|
pub squeeze: Action<f32>,
|
||||||
pub squeeze_click: Action<bool>,
|
// pub squeeze_click: Action<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Resource)]
|
#[derive(Resource)]
|
||||||
@@ -28,9 +28,9 @@ pub struct RightControllerActions {
|
|||||||
pose: Action<Posef>,
|
pose: Action<Posef>,
|
||||||
pub thumbstick: Action<Vector2f>,
|
pub thumbstick: Action<Vector2f>,
|
||||||
pub trigger: Action<f32>,
|
pub trigger: Action<f32>,
|
||||||
pub trigger_click: Action<bool>,
|
// pub trigger_click: Action<bool>,
|
||||||
pub squeeze: Action<f32>,
|
pub squeeze: Action<f32>,
|
||||||
pub squeeze_click: Action<bool>,
|
// pub squeeze_click: Action<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
@@ -92,37 +92,37 @@ fn suggest_action_bindings_left(
|
|||||||
) {
|
) {
|
||||||
bindings.write(OxrSuggestActionBinding {
|
bindings.write(OxrSuggestActionBinding {
|
||||||
action: actions.pose.as_raw(),
|
action: actions.pose.as_raw(),
|
||||||
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
|
interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||||
bindings: vec!["/user/hand/left/input/grip/pose".into()],
|
bindings: vec!["/user/hand/left/input/grip/pose".into()],
|
||||||
});
|
});
|
||||||
|
|
||||||
bindings.write(OxrSuggestActionBinding {
|
bindings.write(OxrSuggestActionBinding {
|
||||||
action: actions.trigger.as_raw(),
|
action: actions.trigger.as_raw(),
|
||||||
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
|
interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||||
bindings: vec!["/user/hand/left/input/trigger/value".into()],
|
bindings: vec!["/user/hand/left/input/trigger/value".into()],
|
||||||
});
|
});
|
||||||
|
|
||||||
bindings.write(OxrSuggestActionBinding {
|
// bindings.write(OxrSuggestActionBinding {
|
||||||
action: actions.trigger_click.as_raw(),
|
// action: actions.trigger_click.as_raw(),
|
||||||
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
|
// interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||||
bindings: vec!["/user/hand/left/input/trigger/click".into()],
|
// bindings: vec!["/user/hand/left/input/trigger/click".into()],
|
||||||
});
|
// });
|
||||||
|
|
||||||
bindings.write(OxrSuggestActionBinding {
|
bindings.write(OxrSuggestActionBinding {
|
||||||
action: actions.squeeze.as_raw(),
|
action: actions.squeeze.as_raw(),
|
||||||
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
|
interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||||
bindings: vec!["/user/hand/left/input/squeeze/value".into()],
|
bindings: vec!["/user/hand/left/input/squeeze/value".into()],
|
||||||
});
|
});
|
||||||
|
|
||||||
bindings.write(OxrSuggestActionBinding {
|
// bindings.write(OxrSuggestActionBinding {
|
||||||
action: actions.squeeze_click.as_raw(),
|
// action: actions.squeeze_click.as_raw(),
|
||||||
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
|
// interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||||
bindings: vec!["/user/hand/left/input/squeeze/click".into()],
|
// bindings: vec!["/user/hand/left/input/squeeze/click".into()],
|
||||||
});
|
// });
|
||||||
|
|
||||||
bindings.write(OxrSuggestActionBinding {
|
bindings.write(OxrSuggestActionBinding {
|
||||||
action: actions.thumbstick.as_raw(),
|
action: actions.thumbstick.as_raw(),
|
||||||
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
|
interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||||
bindings: vec!["/user/hand/left/input/thumbstick".into()],
|
bindings: vec!["/user/hand/left/input/thumbstick".into()],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -133,37 +133,37 @@ fn suggest_action_bindings_right(
|
|||||||
) {
|
) {
|
||||||
bindings.write(OxrSuggestActionBinding {
|
bindings.write(OxrSuggestActionBinding {
|
||||||
action: actions.pose.as_raw(),
|
action: actions.pose.as_raw(),
|
||||||
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
|
interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||||
bindings: vec!["/user/hand/right/input/grip/pose".into()],
|
bindings: vec!["/user/hand/right/input/grip/pose".into()],
|
||||||
});
|
});
|
||||||
|
|
||||||
bindings.write(OxrSuggestActionBinding {
|
bindings.write(OxrSuggestActionBinding {
|
||||||
action: actions.trigger.as_raw(),
|
action: actions.trigger.as_raw(),
|
||||||
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
|
interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||||
bindings: vec!["/user/hand/right/input/trigger/value".into()],
|
bindings: vec!["/user/hand/right/input/trigger/value".into()],
|
||||||
});
|
});
|
||||||
|
|
||||||
bindings.write(OxrSuggestActionBinding {
|
// bindings.write(OxrSuggestActionBinding {
|
||||||
action: actions.trigger_click.as_raw(),
|
// action: actions.trigger_click.as_raw(),
|
||||||
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
|
// interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||||
bindings: vec!["/user/hand/right/input/trigger/click".into()],
|
// bindings: vec!["/user/hand/right/input/trigger/click".into()],
|
||||||
});
|
// });
|
||||||
|
|
||||||
bindings.write(OxrSuggestActionBinding {
|
bindings.write(OxrSuggestActionBinding {
|
||||||
action: actions.squeeze.as_raw(),
|
action: actions.squeeze.as_raw(),
|
||||||
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
|
interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||||
bindings: vec!["/user/hand/right/input/squeeze/value".into()],
|
bindings: vec!["/user/hand/right/input/squeeze/value".into()],
|
||||||
});
|
});
|
||||||
|
|
||||||
bindings.write(OxrSuggestActionBinding {
|
// bindings.write(OxrSuggestActionBinding {
|
||||||
action: actions.squeeze_click.as_raw(),
|
// action: actions.squeeze_click.as_raw(),
|
||||||
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
|
// interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||||
bindings: vec!["/user/hand/right/input/squeeze/click".into()],
|
// bindings: vec!["/user/hand/right/input/squeeze/click".into()],
|
||||||
});
|
// });
|
||||||
|
|
||||||
bindings.write(OxrSuggestActionBinding {
|
bindings.write(OxrSuggestActionBinding {
|
||||||
action: actions.thumbstick.as_raw(),
|
action: actions.thumbstick.as_raw(),
|
||||||
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
|
interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
|
||||||
bindings: vec!["/user/hand/right/input/thumbstick".into()],
|
bindings: vec!["/user/hand/right/input/thumbstick".into()],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -174,13 +174,13 @@ fn create_actions_left(instance: Res<OxrInstance>, mut cmds: Commands) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let pose = set.create_action("pose", "Grip Pose", &[]).unwrap();
|
let pose = set.create_action("pose", "Grip Pose", &[]).unwrap();
|
||||||
let trigger = set.create_action("trigger", "Trigger", &[]).unwrap();
|
let trigger = set.create_action("trigger", "Trigger", &[]).unwrap();
|
||||||
let trigger_click = set
|
// let trigger_click = set
|
||||||
.create_action("trigger_click", "Trigger Click", &[])
|
// .create_action("trigger_click", "Trigger Click", &[])
|
||||||
.unwrap();
|
// .unwrap();
|
||||||
let squeeze = set.create_action("squeeze", "Squeeze", &[]).unwrap();
|
let squeeze = set.create_action("squeeze", "Squeeze", &[]).unwrap();
|
||||||
let squeeze_click = set
|
// let squeeze_click = set
|
||||||
.create_action("squeeze_click", "Squeeze Click", &[])
|
// .create_action("squeeze_click", "Squeeze Click", &[])
|
||||||
.unwrap();
|
// .unwrap();
|
||||||
let thumbstick = set.create_action("thumbstick", "Thumbstick", &[]).unwrap();
|
let thumbstick = set.create_action("thumbstick", "Thumbstick", &[]).unwrap();
|
||||||
|
|
||||||
cmds.insert_resource(LeftControllerActions {
|
cmds.insert_resource(LeftControllerActions {
|
||||||
@@ -188,9 +188,9 @@ fn create_actions_left(instance: Res<OxrInstance>, mut cmds: Commands) {
|
|||||||
pose,
|
pose,
|
||||||
thumbstick,
|
thumbstick,
|
||||||
trigger,
|
trigger,
|
||||||
trigger_click,
|
// trigger_click,
|
||||||
squeeze,
|
squeeze,
|
||||||
squeeze_click,
|
// squeeze_click,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,13 +200,13 @@ fn create_actions_right(instance: Res<OxrInstance>, mut cmds: Commands) {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let pose = set.create_action("pose", "Grip Pose", &[]).unwrap();
|
let pose = set.create_action("pose", "Grip Pose", &[]).unwrap();
|
||||||
let trigger = set.create_action("trigger", "Trigger", &[]).unwrap();
|
let trigger = set.create_action("trigger", "Trigger", &[]).unwrap();
|
||||||
let trigger_click = set
|
// let trigger_click = set
|
||||||
.create_action("trigger_click", "Trigger Click", &[])
|
// .create_action("trigger_click", "Trigger Click", &[])
|
||||||
.unwrap();
|
// .unwrap();
|
||||||
let squeeze = set.create_action("squeeze", "Squeeze", &[]).unwrap();
|
let squeeze = set.create_action("squeeze", "Squeeze", &[]).unwrap();
|
||||||
let squeeze_click = set
|
// let squeeze_click = set
|
||||||
.create_action("squeeze_click", "Squeeze Click", &[])
|
// .create_action("squeeze_click", "Squeeze Click", &[])
|
||||||
.unwrap();
|
// .unwrap();
|
||||||
let thumbstick = set.create_action("thumbstick", "Thumbstick", &[]).unwrap();
|
let thumbstick = set.create_action("thumbstick", "Thumbstick", &[]).unwrap();
|
||||||
|
|
||||||
cmds.insert_resource(RightControllerActions {
|
cmds.insert_resource(RightControllerActions {
|
||||||
@@ -214,9 +214,9 @@ fn create_actions_right(instance: Res<OxrInstance>, mut cmds: Commands) {
|
|||||||
pose,
|
pose,
|
||||||
thumbstick,
|
thumbstick,
|
||||||
trigger,
|
trigger,
|
||||||
trigger_click,
|
// trigger_click,
|
||||||
squeeze,
|
squeeze,
|
||||||
squeeze_click,
|
// squeeze_click,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user