create resource to help with entity selection

This commit is contained in:
Jay Christy
2023-10-09 21:04:20 -04:00
parent 166fe1a2c0
commit 92eb5736eb
3 changed files with 157 additions and 12 deletions

View File

@@ -1,3 +1,85 @@
pub struct Hand {
pub HandJointPoses: [Posef; 26]
}
use bevy::prelude::{Entity, Resource};
#[derive(Resource, Default)]
pub struct HandsResource {
pub left: HandResource,
pub right: HandResource,
}
pub struct HandResource {
pub palm: Entity,
pub wrist: Entity,
pub thumb: ThumbResource,
pub index: IndexResource,
pub middle: MiddleResource,
pub ring: RingResource,
pub little: LittleResource,
}
impl Default for HandResource {
fn default() -> Self {
Self { palm: Entity::PLACEHOLDER, wrist: Entity::PLACEHOLDER, thumb: Default::default(), index: Default::default(), middle: Default::default(), ring: Default::default(), little: Default::default() }
}
}
pub struct ThumbResource {
pub metacarpal: Entity,
pub proximal: Entity,
pub distal: Entity,
pub tip: Entity,
}
impl Default for ThumbResource {
fn default() -> Self {
Self { metacarpal: Entity::PLACEHOLDER, proximal: Entity::PLACEHOLDER, distal: Entity::PLACEHOLDER, tip: Entity::PLACEHOLDER }
}
}
pub struct IndexResource {
pub metacarpal: Entity,
pub proximal: Entity,
pub intermediate: Entity,
pub distal: Entity,
pub tip: Entity,
}
impl Default for IndexResource {
fn default() -> Self {
Self { metacarpal: Entity::PLACEHOLDER, proximal: Entity::PLACEHOLDER, intermediate: Entity::PLACEHOLDER, distal: Entity::PLACEHOLDER, tip: Entity::PLACEHOLDER }
}
}
pub struct MiddleResource {
pub metacarpal: Entity,
pub proximal: Entity,
pub intermediate: Entity,
pub distal: Entity,
pub tip: Entity,
}
impl Default for MiddleResource {
fn default() -> Self {
Self { metacarpal: Entity::PLACEHOLDER, proximal: Entity::PLACEHOLDER, intermediate: Entity::PLACEHOLDER, distal: Entity::PLACEHOLDER, tip: Entity::PLACEHOLDER }
}
}
pub struct RingResource {
pub metacarpal: Entity,
pub proximal: Entity,
pub intermediate: Entity,
pub distal: Entity,
pub tip: Entity,
}
impl Default for RingResource {
fn default() -> Self {
Self { metacarpal: Entity::PLACEHOLDER, proximal: Entity::PLACEHOLDER, intermediate: Entity::PLACEHOLDER, distal: Entity::PLACEHOLDER, tip: Entity::PLACEHOLDER }
}
}
pub struct LittleResource {
pub metacarpal: Entity,
pub proximal: Entity,
pub intermediate: Entity,
pub distal: Entity,
pub tip: Entity,
}
impl Default for LittleResource {
fn default() -> Self {
Self { metacarpal: Entity::PLACEHOLDER, proximal: Entity::PLACEHOLDER, intermediate: Entity::PLACEHOLDER, distal: Entity::PLACEHOLDER, tip: Entity::PLACEHOLDER }
}
}

View File

@@ -5,6 +5,7 @@ pub mod prototype_locomotion;
pub mod trackers;
pub mod xr_camera;
pub mod hand_poses;
pub mod hand;
use crate::resources::XrSession;
use crate::xr_begin_frame;