From 1253b9c038277aebfb5a4cc11685823f2331a26b Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sat, 26 Jan 2019 19:09:48 -0300 Subject: [PATCH] Add a check to help find transforms that are passes invalid. --- servers/visual/visual_server_scene.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index 23ad2ec1ec0..d2046241f03 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -573,6 +573,19 @@ void VisualServerScene::instance_set_transform(RID p_instance, const Transform & if (instance->transform == p_transform) return; //must be checked to avoid worst evil +#ifdef DEBUG_ENABLED + + for (int i = 0; i < 4; i++) { + const Vector3 &v = i < 3 ? p_transform.basis.elements[i] : p_transform.origin; + ERR_FAIL_COND(Math::is_inf(v.x)); + ERR_FAIL_COND(Math::is_nan(v.x)); + ERR_FAIL_COND(Math::is_inf(v.y)); + ERR_FAIL_COND(Math::is_nan(v.y)); + ERR_FAIL_COND(Math::is_inf(v.z)); + ERR_FAIL_COND(Math::is_nan(v.z)); + } + +#endif instance->transform = p_transform; _instance_queue_update(instance, true); }