From 11328f72edf7fdf474999191488721dad6d255a3 Mon Sep 17 00:00:00 2001 From: Jay Christy Date: Wed, 20 Sep 2023 12:46:09 -0400 Subject: [PATCH] first pass at snap rotation --- examples/xr.rs | 59 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/examples/xr.rs b/examples/xr.rs index 2ea58d5..d6bbb41 100644 --- a/examples/xr.rs +++ b/examples/xr.rs @@ -1,4 +1,5 @@ use std::f32::consts::PI; +use std::time::Duration; use bevy::diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}; use bevy::prelude::Gizmos; @@ -66,6 +67,10 @@ fn setup( transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y), ..default() },)); + + commands.insert_resource(RotationTimer { + timer: Timer::from_seconds(1.0, TimerMode::Once), + }) } pub enum LocomotionType { @@ -78,6 +83,11 @@ pub enum RotationType { Snap, } +#[derive(Resource)] +struct RotationTimer { + timer: Timer, +} + fn proto_locomotion( time: Res