openxr: prevent invalid poses

This commit is contained in:
galister
2024-02-06 02:21:43 +01:00
parent 2d133b4636
commit 815eb4bd78

View File

@@ -146,7 +146,10 @@ pub(super) fn transform_to_posef(transform: &Affine3A) -> xr::Posef {
let norm_mat3 = transform
.matrix3
.mul_scalar(1.0 / transform.matrix3.x_axis.length());
let rotation = Quat::from_mat3a(&norm_mat3).normalize();
let mut rotation = Quat::from_mat3a(&norm_mat3).normalize();
if !rotation.is_finite() {
rotation = Quat::IDENTITY;
}
xr::Posef {
orientation: xr::Quaternionf {