openxr: prevent invalid poses
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user