pull changes from webxr-refactor

Signed-off-by: Schmarni <marnistromer@gmail.com>
This commit is contained in:
Schmarni
2024-06-05 00:32:38 +02:00
6 changed files with 60 additions and 33 deletions

View File

@@ -37,17 +37,21 @@ fn setup(
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
let mut white: StandardMaterial = Color::WHITE.into();
white.unlit = true;
// circular base
commands.spawn(PbrBundle {
mesh: meshes.add(Circle::new(4.0)),
material: materials.add(Color::WHITE),
material: materials.add(white),
transform: Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)),
..default()
});
let mut cube_mat: StandardMaterial = Color::rgb_u8(124, 144, 255).into();
cube_mat.unlit = true;
// cube
commands.spawn(PbrBundle {
mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)),
material: materials.add(Color::rgb_u8(124, 144, 255)),
material: materials.add(cube_mat),
transform: Transform::from_xyz(0.0, 0.5, 0.0),
..default()
});

View File

@@ -17,8 +17,8 @@ fn main() {
fn handle_input(
keys: Res<ButtonInput<KeyCode>>,
mut end: EventWriter<bevy_xr::session::EndXrSession>,
mut destroy: EventWriter<bevy_xr::session::DestroyXrSession>,
mut begin: EventWriter<bevy_xr::session::BeginXrSession>,
mut _destroy: EventWriter<bevy_xr::session::DestroyXrSession>,
mut _begin: EventWriter<bevy_xr::session::BeginXrSession>,
mut create: EventWriter<bevy_xr::session::CreateXrSession>,
state: Res<XrStatus>,
) {
@@ -26,14 +26,6 @@ fn handle_input(
info!("sending end");
end.send_default();
}
if keys.just_pressed(KeyCode::KeyD) {
info!("sending destroy");
destroy.send_default();
}
if keys.just_pressed(KeyCode::KeyB) {
info!("sending begin");
begin.send_default();
}
if keys.just_pressed(KeyCode::KeyC) {
info!("sending create");
create.send_default();