mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-18 07:35:19 +00:00
Only update plane location when camera has moved
This commit is contained in:
@@ -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<OrbitCam>>,
|
||||
) {
|
||||
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)]
|
||||
|
||||
Reference in New Issue
Block a user