add interaction profile changed event, support velocities and expose Space(Location/Velocity)Flags as components
Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
@@ -3,19 +3,29 @@ use bevy::{
|
||||
render::{extract_component::ExtractComponent, extract_resource::ExtractResource},
|
||||
};
|
||||
|
||||
use crate::types::XrPose;
|
||||
|
||||
/// Any Spaces will be invalid after the owning session exits
|
||||
#[repr(transparent)]
|
||||
#[derive(Clone, Copy, Hash, PartialEq, Eq, Reflect, Debug, Component, ExtractComponent)]
|
||||
pub struct XrSpace(u64);
|
||||
|
||||
// Does repr(transparent) even make sense here?
|
||||
#[repr(transparent)]
|
||||
#[derive(
|
||||
Clone, Copy, PartialEq, Reflect, Debug, Component, ExtractComponent, Default, Deref, DerefMut,
|
||||
)]
|
||||
pub struct XrSpatialOffset(pub XrPose);
|
||||
#[derive(Clone, Copy, Reflect, Debug, Component, ExtractComponent, Default)]
|
||||
pub struct XrVelocity {
|
||||
/// Velocity of a space relative to it's reference space
|
||||
pub linear: Vec3,
|
||||
/// Angular Velocity of a space relative to it's reference space
|
||||
/// the direction of the vector is parrelel to the axis of rotation,
|
||||
/// the magnitude is the relative angular speed in radians per second
|
||||
/// the vector follows the right-hand rule for torque/rotation
|
||||
pub angular: Vec3,
|
||||
}
|
||||
impl XrVelocity {
|
||||
pub const fn new() -> XrVelocity {
|
||||
XrVelocity {
|
||||
linear: Vec3::ZERO,
|
||||
angular: Vec3::ZERO,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Event, Clone, Copy, Deref, DerefMut)]
|
||||
pub struct XrDestroySpace(pub XrSpace);
|
||||
|
||||
Reference in New Issue
Block a user