mirror of https://github.com/wayvr-org/wayvr.git
openxr: prevent invalid poses
This commit is contained in:
parent
2d133b4636
commit
815eb4bd78
|
|
@ -146,7 +146,10 @@ pub(super) fn transform_to_posef(transform: &Affine3A) -> xr::Posef {
|
||||||
let norm_mat3 = transform
|
let norm_mat3 = transform
|
||||||
.matrix3
|
.matrix3
|
||||||
.mul_scalar(1.0 / transform.matrix3.x_axis.length());
|
.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 {
|
xr::Posef {
|
||||||
orientation: xr::Quaternionf {
|
orientation: xr::Quaternionf {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue