From 7738cdb27c58b4295262326526859e6642ab5b0a Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Mon, 6 Jan 2025 19:38:57 -0500 Subject: [PATCH] chore: Don't set position if values are NaN. --- src/lib.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9378a66..db2a719 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -441,14 +441,16 @@ fn update_source_properties( if let Some(source) = handle.cast_to::().expect("Failed to cast") { if let Some(transform) = transform { let translation = transform.translation(); - source - .position() - .set(( - translation.x as f64, - translation.y as f64, - translation.z as f64, - )) - .expect("Failed to set position"); + if !translation.x.is_nan() && !translation.y.is_nan() && !translation.z.is_nan() { + source + .position() + .set(( + translation.x as f64, + translation.y as f64, + translation.z as f64, + )) + .expect("Failed to set position"); + } let distance_model = distance_model .cloned() .map(|v| *v)