From 263168fc26d392219e0a4c1b71734656c7a0074f Mon Sep 17 00:00:00 2001 From: Jay Christy Date: Tue, 19 Sep 2023 16:18:20 -0400 Subject: [PATCH 01/10] first attempt at locomotion --- examples/xr.rs | 38 ++++++++++++++++++++++++++++++++++++ src/xr_input/debug_gizmos.rs | 32 +++++++++++++++++++++++------- src/xr_input/mod.rs | 18 ++++++++++++----- src/xr_input/xr_camera.rs | 1 + 4 files changed, 77 insertions(+), 12 deletions(-) diff --git a/examples/xr.rs b/examples/xr.rs index 35d766ad..f6459ee3 100644 --- a/examples/xr.rs +++ b/examples/xr.rs @@ -1,7 +1,11 @@ use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}; use bevy::prelude::*; use bevy::transform::components::Transform; +use bevy_openxr::input::XrInput; +use bevy_openxr::resources::{XrFrameState, XrInstance, XrSession}; use bevy_openxr::xr_input::debug_gizmos::OpenXrDebugRenderer; +use bevy_openxr::xr_input::oculus_touch::OculusController; +use bevy_openxr::xr_input::{Hand, TrackingRoot}; use bevy_openxr::DefaultXrPlugins; fn main() { @@ -14,6 +18,7 @@ fn main() { .add_plugins(LogDiagnosticsPlugin::default()) .add_plugins(FrameTimeDiagnosticsPlugin) .add_systems(Startup, setup) + .add_systems(Update, proto_locomotion) .run(); } @@ -36,6 +41,13 @@ fn setup( transform: Transform::from_xyz(0.0, 0.5, 0.0), ..default() }); + // cube + commands.spawn(PbrBundle { + mesh: meshes.add(Mesh::from(shape::Cube { size: 0.1 })), + material: materials.add(Color::rgb(0.8, 0.0, 0.0).into()), + transform: Transform::from_xyz(0.0, 0.5, 1.0), + ..default() + }); // light commands.spawn(PointLightBundle { point_light: PointLight { @@ -52,3 +64,29 @@ fn setup( ..default() },)); } + +fn proto_locomotion( + time: Res