fmt
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
use bevy::ecs::schedule::{IntoSystemConfigs, SystemConfigs};
|
||||
|
||||
pub use crate::xr_init::schedules::XrSetup;
|
||||
use crate::xr_init::xr_only;
|
||||
pub use crate::xr_input::{QuatConv, Vec2Conv, Vec3Conv};
|
||||
pub use crate::xr_init::schedules::XrSetup;
|
||||
|
||||
pub trait XrSystems<Marker> {
|
||||
fn xr_only(self) -> SystemConfigs;
|
||||
|
||||
@@ -94,7 +94,7 @@ impl Plugin for XrInitPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Resource, Clone, Copy, PartialEq, Eq,Default)]
|
||||
#[derive(Resource, Clone, Copy, PartialEq, Eq, Default)]
|
||||
pub enum ExitAppOnSessionExit {
|
||||
#[default]
|
||||
/// Restart XrSession when session is lost
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
use bevy::{ecs::schedule::{ScheduleLabel, Schedule, ExecutorKind}, app::App};
|
||||
use bevy::{
|
||||
app::App,
|
||||
ecs::schedule::{ExecutorKind, Schedule, ScheduleLabel},
|
||||
};
|
||||
|
||||
#[derive(Debug, ScheduleLabel, Clone, Copy, Hash, PartialEq, Eq)]
|
||||
pub struct XrPreSetup;
|
||||
|
||||
@@ -186,7 +186,12 @@ fn draw_hand_gizmo(
|
||||
let b_offset_quat = face_quat;
|
||||
let b_translation_vec3 =
|
||||
face_translation_vec3 + b_offset_quat.mul_vec3(Vec3::new(0.025, -0.01, 0.0));
|
||||
gizmos.circle(b_translation_vec3, Direction3d::new_unchecked(face_quat_normal), 0.0075, b_color);
|
||||
gizmos.circle(
|
||||
b_translation_vec3,
|
||||
Direction3d::new_unchecked(face_quat_normal),
|
||||
0.0075,
|
||||
b_color,
|
||||
);
|
||||
|
||||
//button a
|
||||
let mut a_color = off_color;
|
||||
@@ -200,7 +205,12 @@ fn draw_hand_gizmo(
|
||||
let a_offset_quat = face_quat;
|
||||
let a_translation_vec3 =
|
||||
face_translation_vec3 + a_offset_quat.mul_vec3(Vec3::new(0.025, 0.01, 0.0));
|
||||
gizmos.circle(a_translation_vec3, Direction3d::new_unchecked(face_quat_normal), 0.0075, a_color);
|
||||
gizmos.circle(
|
||||
a_translation_vec3,
|
||||
Direction3d::new_unchecked(face_quat_normal),
|
||||
0.0075,
|
||||
a_color,
|
||||
);
|
||||
|
||||
//joystick
|
||||
let joystick_offset_quat = face_quat;
|
||||
@@ -212,7 +222,12 @@ fn draw_hand_gizmo(
|
||||
}
|
||||
|
||||
//base
|
||||
gizmos.circle(joystick_base_vec, Direction3d::new_unchecked(face_quat_normal), 0.014, joystick_color);
|
||||
gizmos.circle(
|
||||
joystick_base_vec,
|
||||
Direction3d::new_unchecked(face_quat_normal),
|
||||
0.014,
|
||||
joystick_color,
|
||||
);
|
||||
|
||||
let stick = controller.thumbstick(Hand::Left);
|
||||
let input = Vec3::new(stick.x, -stick.y, 0.0);
|
||||
@@ -220,7 +235,12 @@ fn draw_hand_gizmo(
|
||||
+ joystick_offset_quat.mul_vec3(Vec3::new(-0.02, 0.0, -0.01))
|
||||
+ joystick_offset_quat.mul_vec3(input * 0.01);
|
||||
//top
|
||||
gizmos.circle(joystick_top_vec, Direction3d::new_unchecked(face_quat_normal), 0.005, joystick_color);
|
||||
gizmos.circle(
|
||||
joystick_top_vec,
|
||||
Direction3d::new_unchecked(face_quat_normal),
|
||||
0.005,
|
||||
joystick_color,
|
||||
);
|
||||
|
||||
//trigger
|
||||
let trigger_state = controller.trigger(Hand::Left);
|
||||
@@ -295,7 +315,12 @@ fn draw_hand_gizmo(
|
||||
let b_offset_quat = face_quat;
|
||||
let b_translation_vec3 =
|
||||
face_translation_vec3 + b_offset_quat.mul_vec3(Vec3::new(-0.025, -0.01, 0.0));
|
||||
gizmos.circle(b_translation_vec3, Direction3d::new_unchecked(face_quat_normal), 0.0075, b_color);
|
||||
gizmos.circle(
|
||||
b_translation_vec3,
|
||||
Direction3d::new_unchecked(face_quat_normal),
|
||||
0.0075,
|
||||
b_color,
|
||||
);
|
||||
|
||||
//button a
|
||||
let mut a_color = off_color;
|
||||
@@ -309,7 +334,12 @@ fn draw_hand_gizmo(
|
||||
let a_offset_quat = face_quat;
|
||||
let a_translation_vec3 =
|
||||
face_translation_vec3 + a_offset_quat.mul_vec3(Vec3::new(-0.025, 0.01, 0.0));
|
||||
gizmos.circle(a_translation_vec3, Direction3d::new_unchecked(face_quat_normal), 0.0075, a_color);
|
||||
gizmos.circle(
|
||||
a_translation_vec3,
|
||||
Direction3d::new_unchecked(face_quat_normal),
|
||||
0.0075,
|
||||
a_color,
|
||||
);
|
||||
|
||||
//joystick time
|
||||
let joystick_offset_quat = face_quat;
|
||||
@@ -321,7 +351,12 @@ fn draw_hand_gizmo(
|
||||
}
|
||||
|
||||
//base
|
||||
gizmos.circle(joystick_base_vec, Direction3d::new_unchecked(face_quat_normal), 0.014, joystick_color);
|
||||
gizmos.circle(
|
||||
joystick_base_vec,
|
||||
Direction3d::new_unchecked(face_quat_normal),
|
||||
0.014,
|
||||
joystick_color,
|
||||
);
|
||||
|
||||
let stick = controller.thumbstick(Hand::Right);
|
||||
let input = Vec3::new(stick.x, -stick.y, 0.0);
|
||||
@@ -329,7 +364,12 @@ fn draw_hand_gizmo(
|
||||
+ joystick_offset_quat.mul_vec3(Vec3::new(0.02, 0.0, -0.01))
|
||||
+ joystick_offset_quat.mul_vec3(input * 0.01);
|
||||
//top
|
||||
gizmos.circle(joystick_top_vec, Direction3d::new_unchecked(face_quat_normal), 0.005, joystick_color);
|
||||
gizmos.circle(
|
||||
joystick_top_vec,
|
||||
Direction3d::new_unchecked(face_quat_normal),
|
||||
0.005,
|
||||
joystick_color,
|
||||
);
|
||||
|
||||
//trigger
|
||||
let trigger_state = controller.trigger(Hand::Right);
|
||||
|
||||
@@ -31,7 +31,9 @@ use bevy::utils::HashMap;
|
||||
use openxr::Binding;
|
||||
|
||||
use self::actions::{setup_oxr_actions, XrActionsPlugin};
|
||||
use self::oculus_touch::{init_subaction_path, post_action_setup_oculus_controller, ActionSets, OculusController};
|
||||
use self::oculus_touch::{
|
||||
init_subaction_path, post_action_setup_oculus_controller, ActionSets, OculusController,
|
||||
};
|
||||
use self::trackers::{
|
||||
adopt_open_xr_trackers, update_open_xr_controllers, OpenXRLeftEye, OpenXRRightEye,
|
||||
OpenXRTrackingRoot,
|
||||
@@ -63,7 +65,7 @@ impl Plugin for XrInputPlugin {
|
||||
}
|
||||
|
||||
fn cleanup_oculus_controller(mut commands: Commands) {
|
||||
commands.remove_resource::<OculusController>();
|
||||
commands.remove_resource::<OculusController>();
|
||||
}
|
||||
|
||||
fn cleanup_xr_root(
|
||||
|
||||
Reference in New Issue
Block a user