add XrTracker component that auto parents the entity to the XrTrackingRoot, XrSpace requires XrTracker

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2024-11-20 11:46:24 +01:00
parent d1cc160cac
commit a04ebb8426
10 changed files with 128 additions and 203 deletions

View File

@@ -1,7 +1,6 @@
use core::panic;
use bevy::app::{App, Plugin, PostUpdate};
use bevy::core_pipeline::core_3d::graph::Core3d;
use bevy::core_pipeline::core_3d::Camera3d;
use bevy::ecs::component::{Component, StorageType};
use bevy::ecs::reflect::ReflectComponent;
@@ -18,6 +17,8 @@ use bevy::render::extract_component::{ExtractComponent, ExtractComponentPlugin};
use bevy::render::view::{update_frusta, VisibilitySystems};
use bevy::transform::TransformSystem;
use crate::session::XrTracker;
pub struct XrCameraPlugin;
impl Plugin for XrCameraPlugin {
@@ -69,7 +70,7 @@ impl Default for XrProjection {
/// Marker component for an XR view. It is the backends responsibility to update this.
#[derive(Clone, Copy, Component, ExtractComponent, Debug, Default)]
#[require(Camera3d, XrProjection)]
#[require(Camera3d, XrProjection, XrTracker)]
pub struct XrCamera(pub u32);
impl CameraProjection for XrProjection {