diff --git a/hello-world/src/test_scene.rs b/hello-world/src/test_scene.rs index 9ae8741..a3c66ca 100644 --- a/hello-world/src/test_scene.rs +++ b/hello-world/src/test_scene.rs @@ -18,7 +18,7 @@ impl Plugin for TestScenePlugin { }) .add_systems(Startup, spawn_scene) .add_systems( - Update, + PostUpdate, move_plane_with_camera.after(orbit_cam::pan_orbit_camera), ); } @@ -93,13 +93,14 @@ fn spawn_scene( fn move_plane_with_camera( mut plane: Query<(&WorldGridPlane, &mut Transform)>, - camera: Query<&OrbitCam>, + camera: Query<&OrbitCam, Changed>, ) { - let &OrbitCam { focus, .. } = camera.single(); - let (_, mut xform) = plane.single_mut(); + if let Ok(&OrbitCam { focus, .. }) = camera.get_single() { + let (_, mut xform) = plane.single_mut(); - xform.translation.x = focus.x; - xform.translation.z = focus.z; + xform.translation.x = focus.x; + xform.translation.z = focus.z; + } } #[derive(AsBindGroup, Clone, TypePath, TypeUuid)]