summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Laforte <guillaume.laforte@gmail.com>2018-11-28 08:56:01 -0500
committerGuillaume Laforte <guillaume.laforte@gmail.com>2018-11-28 08:56:01 -0500
commitfdb1fe6b927deb068a80c0dbf9a892f51108abbf (patch)
tree6a9bfa1d255cca4cf0b3f008ca610906e3c037fa
parent1c169413ffb8a5d446caaa41cc604bbf0cb6cc40 (diff)
Changes the check for a singular matrix to use the scale vector.
The check for the determinant does not have enough precision when used with a 0.01 uniform scale.
-rw-r--r--editor/import/editor_import_collada.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index afd09748f3..cdc35a98e2 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -1655,8 +1655,9 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
}
}
- Quat q = Math::is_equal_approx(xform.basis.determinant(), 0) ? Quat() : xform.basis.get_rotation_quat();
Vector3 s = xform.basis.get_scale();
+ bool singular_matrix = Math::is_equal_approx(s.x, 0.0f) || Math::is_equal_approx(s.y, 0.0f) || Math::is_equal_approx(s.z, 0.0f);
+ Quat q = singular_matrix ? Quat() : xform.basis.get_rotation_quat();
Vector3 l = xform.origin;
animation->transform_track_insert_key(track, snapshots[i], l, q, s);
@@ -1705,8 +1706,9 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
xform = sk->get_bone_rest(nm.bone).affine_inverse() * xform;
- Quat q = Math::is_equal_approx(xform.basis.determinant(), 0) ? Quat() : xform.basis.get_rotation_quat();
Vector3 s = xform.basis.get_scale();
+ bool singular_matrix = Math::is_equal_approx(s.x, 0.0f) || Math::is_equal_approx(s.y, 0.0f) || Math::is_equal_approx(s.z, 0.0f);
+ Quat q = singular_matrix ? Quat() : xform.basis.get_rotation_quat();
Vector3 l = xform.origin;
animation->transform_track_insert_key(track, 0, l, q, s);