added tracker markers and change detection
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
pub mod controllers;
|
||||
pub mod debug_gizmos;
|
||||
pub mod oculus_touch;
|
||||
pub mod trackers;
|
||||
pub mod xr_camera;
|
||||
|
||||
use crate::resources::XrSession;
|
||||
@@ -10,12 +11,16 @@ use crate::xr_input::oculus_touch::{setup_oculus_controller, ActionSets};
|
||||
use crate::xr_input::xr_camera::{xr_camera_head_sync, Eye, XRProjection, XrCameraBundle};
|
||||
use bevy::app::{App, PostUpdate, Startup};
|
||||
use bevy::log::warn;
|
||||
use bevy::prelude::{default, Commands, Component, Plugin, PreUpdate, Quat, Res, Vec3};
|
||||
use bevy::prelude::{
|
||||
default, Commands, Component, Plugin, PreUpdate, Quat, Res, SpatialBundle, Vec3,
|
||||
};
|
||||
use bevy::prelude::{BuildChildren, IntoSystemConfigs};
|
||||
use bevy::render::camera::CameraProjectionPlugin;
|
||||
use bevy::render::view::{update_frusta, VisibilitySystems};
|
||||
use bevy::transform::{TransformBundle, TransformSystem};
|
||||
|
||||
use self::trackers::{OpenXRLeftEye, OpenXRRightEye, OpenXRTrackingRoot};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct OpenXrInput {
|
||||
pub controller_type: XrControllerType,
|
||||
@@ -26,9 +31,6 @@ pub enum Hand {
|
||||
Right,
|
||||
}
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct TrackingRoot;
|
||||
|
||||
impl OpenXrInput {
|
||||
pub fn new(controller_type: XrControllerType) -> Self {
|
||||
Self { controller_type }
|
||||
@@ -58,9 +60,15 @@ impl Plugin for OpenXrInput {
|
||||
fn setup_xr_cameras(mut commands: Commands) {
|
||||
//this needs to do the whole xr tracking volume not just cameras
|
||||
//get the root?
|
||||
let tracking_root = commands.spawn((TransformBundle { ..default() }, TrackingRoot)).id();
|
||||
let right = commands.spawn(XrCameraBundle::new(Eye::Right)).id();
|
||||
let left = commands.spawn(XrCameraBundle::new(Eye::Left)).id();
|
||||
let tracking_root = commands
|
||||
.spawn((SpatialBundle::default(), OpenXRTrackingRoot))
|
||||
.id();
|
||||
let right = commands
|
||||
.spawn((XrCameraBundle::new(Eye::Right), OpenXRRightEye))
|
||||
.id();
|
||||
let left = commands
|
||||
.spawn((XrCameraBundle::new(Eye::Left), OpenXRLeftEye))
|
||||
.id();
|
||||
commands.entity(tracking_root).push_children(&[right, left]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user