More basic controller profile

This commit is contained in:
2026-02-25 23:39:38 +01:00
parent ebcde11632
commit fecc9c4de5
2 changed files with 52 additions and 52 deletions

View File

@@ -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)
* 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)
&& trigger_state.current_state
if let Ok(trigger_state) = left.squeeze.state(&session, Path::NULL)
&& trigger_state.current_state >= 1.0
{
let Ok(transform) = left_transform.single() else {
return;
@@ -578,8 +578,8 @@ fn move_kneeboard(
kneeboard.rotation = transform.rotation * rot_offset;
}
if let Ok(trigger_state) = right.squeeze_click.state(&session, Path::NULL)
&& trigger_state.current_state
if let Ok(trigger_state) = right.squeeze.state(&session, Path::NULL)
&& trigger_state.current_state >= 1.0
{
let Ok(transform) = right_transform.single() else {
return;

View File

@@ -17,9 +17,9 @@ pub struct LeftControllerActions {
pose: Action<Posef>,
pub thumbstick: Action<Vector2f>,
pub trigger: Action<f32>,
pub trigger_click: Action<bool>,
// pub trigger_click: Action<bool>,
pub squeeze: Action<f32>,
pub squeeze_click: Action<bool>,
// pub squeeze_click: Action<bool>,
}
#[derive(Resource)]
@@ -28,9 +28,9 @@ pub struct RightControllerActions {
pose: Action<Posef>,
pub thumbstick: Action<Vector2f>,
pub trigger: Action<f32>,
pub trigger_click: Action<bool>,
// pub trigger_click: Action<bool>,
pub squeeze: Action<f32>,
pub squeeze_click: Action<bool>,
// pub squeeze_click: Action<bool>,
}
#[derive(Component)]
@@ -92,37 +92,37 @@ fn suggest_action_bindings_left(
) {
bindings.write(OxrSuggestActionBinding {
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.write(OxrSuggestActionBinding {
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.write(OxrSuggestActionBinding {
action: actions.trigger_click.as_raw(),
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
bindings: vec!["/user/hand/left/input/trigger/click".into()],
});
// bindings.write(OxrSuggestActionBinding {
// action: actions.trigger_click.as_raw(),
// interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
// bindings: vec!["/user/hand/left/input/trigger/click".into()],
// });
bindings.write(OxrSuggestActionBinding {
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.write(OxrSuggestActionBinding {
action: actions.squeeze_click.as_raw(),
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
bindings: vec!["/user/hand/left/input/squeeze/click".into()],
});
// bindings.write(OxrSuggestActionBinding {
// action: actions.squeeze_click.as_raw(),
// interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
// bindings: vec!["/user/hand/left/input/squeeze/click".into()],
// });
bindings.write(OxrSuggestActionBinding {
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()],
});
}
@@ -133,37 +133,37 @@ fn suggest_action_bindings_right(
) {
bindings.write(OxrSuggestActionBinding {
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.write(OxrSuggestActionBinding {
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.write(OxrSuggestActionBinding {
action: actions.trigger_click.as_raw(),
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
bindings: vec!["/user/hand/right/input/trigger/click".into()],
});
// bindings.write(OxrSuggestActionBinding {
// action: actions.trigger_click.as_raw(),
// interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
// bindings: vec!["/user/hand/right/input/trigger/click".into()],
// });
bindings.write(OxrSuggestActionBinding {
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.write(OxrSuggestActionBinding {
action: actions.squeeze_click.as_raw(),
interaction_profile: "/interaction_profiles/bytedance/pico4_controller".into(),
bindings: vec!["/user/hand/right/input/squeeze/click".into()],
});
// bindings.write(OxrSuggestActionBinding {
// action: actions.squeeze_click.as_raw(),
// interaction_profile: "/interaction_profiles/oculus/touch_controller".into(),
// bindings: vec!["/user/hand/right/input/squeeze/click".into()],
// });
bindings.write(OxrSuggestActionBinding {
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()],
});
}
@@ -174,13 +174,13 @@ fn create_actions_left(instance: Res<OxrInstance>, mut cmds: Commands) {
.unwrap();
let pose = set.create_action("pose", "Grip Pose", &[]).unwrap();
let trigger = set.create_action("trigger", "Trigger", &[]).unwrap();
let trigger_click = set
.create_action("trigger_click", "Trigger Click", &[])
.unwrap();
// let trigger_click = set
// .create_action("trigger_click", "Trigger Click", &[])
// .unwrap();
let squeeze = set.create_action("squeeze", "Squeeze", &[]).unwrap();
let squeeze_click = set
.create_action("squeeze_click", "Squeeze Click", &[])
.unwrap();
// let squeeze_click = set
// .create_action("squeeze_click", "Squeeze Click", &[])
// .unwrap();
let thumbstick = set.create_action("thumbstick", "Thumbstick", &[]).unwrap();
cmds.insert_resource(LeftControllerActions {
@@ -188,9 +188,9 @@ fn create_actions_left(instance: Res<OxrInstance>, mut cmds: Commands) {
pose,
thumbstick,
trigger,
trigger_click,
// trigger_click,
squeeze,
squeeze_click,
// squeeze_click,
})
}
@@ -200,13 +200,13 @@ fn create_actions_right(instance: Res<OxrInstance>, mut cmds: Commands) {
.unwrap();
let pose = set.create_action("pose", "Grip Pose", &[]).unwrap();
let trigger = set.create_action("trigger", "Trigger", &[]).unwrap();
let trigger_click = set
.create_action("trigger_click", "Trigger Click", &[])
.unwrap();
// let trigger_click = set
// .create_action("trigger_click", "Trigger Click", &[])
// .unwrap();
let squeeze = set.create_action("squeeze", "Squeeze", &[]).unwrap();
let squeeze_click = set
.create_action("squeeze_click", "Squeeze Click", &[])
.unwrap();
// let squeeze_click = set
// .create_action("squeeze_click", "Squeeze Click", &[])
// .unwrap();
let thumbstick = set.create_action("thumbstick", "Thumbstick", &[]).unwrap();
cmds.insert_resource(RightControllerActions {
@@ -214,9 +214,9 @@ fn create_actions_right(instance: Res<OxrInstance>, mut cmds: Commands) {
pose,
thumbstick,
trigger,
trigger_click,
// trigger_click,
squeeze,
squeeze_click,
// squeeze_click,
})
}