Skip to content

Commit

Permalink
pulled debug rendering into its own plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ForTehLose committed Oct 14, 2023
1 parent 508a2ac commit 6770c97
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/xr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin};
use bevy::prelude::*;
use bevy::transform::components::Transform;

use bevy_openxr::xr_input::hand::OpenXrHandInput;
use bevy_openxr::xr_input::hand::{OpenXrHandInput, HandInputDebugRenderer};
use bevy_openxr::xr_input::prototype_locomotion::{proto_locomotion, PrototypeLocomotionConfig};
use bevy_openxr::xr_input::trackers::{
OpenXRController, OpenXRLeftController, OpenXRRightController, OpenXRTracker,
Expand All @@ -26,6 +26,7 @@ fn main() {
.insert_resource(PrototypeLocomotionConfig::default())
.add_systems(Startup, spawn_controllers_example)
.add_plugins(OpenXrHandInput)
.add_plugins(HandInputDebugRenderer)
.run();
}

Expand Down
11 changes: 10 additions & 1 deletion src/xr_input/hand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,22 @@ impl Plugin for OpenXrHandInput {
fn build(&self, app: &mut bevy::prelude::App) {
app.add_systems(Update, update_hand_skeletons)
.add_systems(PreUpdate, update_hand_states)
.add_systems(PostUpdate, draw_hand_entities)
.add_systems(Startup, spawn_hand_entities)
.insert_resource(HandStatesResource::default())
.insert_resource(HandInputSource::default());
}
}

/// add debug renderer for controllers
#[derive(Default)]
pub struct HandInputDebugRenderer;

impl Plugin for HandInputDebugRenderer{
fn build(&self, app: &mut bevy::prelude::App) {
app.add_systems(PostUpdate, draw_hand_entities);
}
}

#[derive(Resource)]
pub enum HandInputSource {
Emulated,
Expand Down

0 comments on commit 6770c97

Please sign in to comment.