diff --git a/Cargo.toml b/Cargo.toml index b0eba02..ad067c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,9 @@ openxr = { workspace = true, features = [ "mint", "static" ] } ndk-context = "0.1" jni = "0.20" +[dev-dependencies] +color-eyre.workspace = true + [[example]] name = "xr" path = "examples/xr.rs" diff --git a/examples/demo/src/lib.rs b/examples/demo/src/lib.rs index 4c4911a..05d96d8 100644 --- a/examples/demo/src/lib.rs +++ b/examples/demo/src/lib.rs @@ -1,27 +1,27 @@ -use std::{f32::consts::PI, ops::Mul, time::Duration}; +mod setup; + +use std::time::Duration; use bevy::{ diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, ecs::schedule::ScheduleLabel, - input::{keyboard::KeyCode, ButtonInput}, log::info, math::primitives::{Capsule3d, Cuboid}, prelude::{ - bevy_main, default, shape, App, Assets, Color, Commands, Component, Entity, Event, - EventReader, EventWriter, FixedUpdate, Gizmos, GlobalTransform, IntoSystemConfigs, - IntoSystemSetConfigs, Mesh, PbrBundle, PostUpdate, Quat, Query, Res, ResMut, Resource, - Schedule, SpatialBundle, StandardMaterial, Startup, Transform, Update, Vec3, Vec3Swizzles, - With, Without, World, + bevy_main, default, App, Assets, Color, Commands, Component, Entity, Event, EventReader, + EventWriter, FixedUpdate, GlobalTransform, IntoSystemConfigs, IntoSystemSetConfigs, Mesh, + PbrBundle, PostUpdate, Query, Res, ResMut, Resource, Schedule, SpatialBundle, + StandardMaterial, Startup, Transform, Update, Vec3, With, Without, World, }, render::mesh::Meshable, time::{Fixed, Time, Timer, TimerMode}, transform::TransformSystem, }; use bevy_oxr::{ - graphics::{extensions::XrExtensions, XrAppInfo, XrPreferdBlendMode}, + graphics::{extensions::XrExtensions, XrAppInfo}, input::XrInput, - resources::{XrFrameState, XrInstance, XrSession}, - xr_init::{xr_only, XrStatus}, + resources::{XrFrameState, XrSession}, + xr_init::xr_only, xr_input::{ actions::XrActionSets, debug_gizmos::OpenXrDebugRenderer, @@ -34,29 +34,12 @@ use bevy_oxr::{ }, oculus_touch::OculusController, prototype_locomotion::{proto_locomotion, PrototypeLocomotionConfig}, - trackers::{ - OpenXRController, OpenXRLeftController, OpenXRRightController, OpenXRTracker, - OpenXRTrackingRoot, - }, + trackers::{OpenXRController, OpenXRLeftController, OpenXRRightController, OpenXRTracker}, Hand, }, DefaultXrPlugins, }; -// fn input_stuff( -// keys: Res>, -// status: Res, -// mut request: EventWriter, -// ) { -// if keys.just_pressed(KeyCode::Space) { -// match status.into_inner() { -// XrEnableStatus::Enabled => request.send(XrEnableRequest::TryDisable), -// XrEnableStatus::Disabled => request.send(XrEnableRequest::TryEnable), -// } -// } -// } - -mod setup; use crate::setup::setup_scene; use bevy_rapier3d::prelude::*; @@ -376,7 +359,6 @@ fn update_physics_hands( )>, hand_query: Query<(&Transform, &HandBone, &Hand), Without>, time: Res