-
bevy 0.10.1 fn light_follow_camera_system(
cam_q: Query<&Transform, With<FlyCam>>,
mut light_q: Query<&mut Transform, With<PointLight>>,
) {
let camera_position = if let Some(tfm) = cam_q.iter().next() {
tfm.translation
} else {
return;
};
if let Some(mut tfm) = light_q.iter_mut().next() {
tfm.translation = camera_position;
}
} and find that :
|
Beta Was this translation helpful? Give feedback.
Answered by
nicopap
Jul 1, 2023
Replies: 1 comment 1 reply
-
You need to add a cam_q: Query<&Transform, (With<FlyCam>, Without<PointLight>)>, |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
zzhgithub
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to add a
Without
filter to thecam_q
query. This allows bevy to tellcam_q
andlight_q
do not overlap, and therefore can run safely without violating rust's borrowing rules: