diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-23 10:32:06 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-23 10:32:06 +0100 |
commit | 35c37ce4ce5d1559ae4548ebb2c0c7286cb90a3d (patch) | |
tree | a7cfdf2d0b0167184837d069fdc70ea5557cfbc5 /scene/3d/collision_object_3d.cpp | |
parent | 59dce77d4f055b6211c5832cbd0ee14af4deefea (diff) | |
parent | 0e6b796cf6c6ffb01f3b3d4018843e298a7f4479 (diff) | |
download | redot-engine-35c37ce4ce5d1559ae4548ebb2c0c7286cb90a3d.tar.gz |
Merge pull request #67847 from rburing/warn_non-uniformists
Warn against using non-uniform scale for 3D physics (in the editor and class reference)
Diffstat (limited to 'scene/3d/collision_object_3d.cpp')
-rw-r--r-- | scene/3d/collision_object_3d.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp index 26ada1da5a..19d1b83cab 100644 --- a/scene/3d/collision_object_3d.cpp +++ b/scene/3d/collision_object_3d.cpp @@ -43,6 +43,11 @@ void CollisionObject3D::_notification(int p_what) { } _update_debug_shapes(); } +#ifdef TOOLS_ENABLED + if (Engine::get_singleton()->is_editor_hint()) { + set_notify_local_transform(true); // Used for warnings and only in editor. + } +#endif } break; case NOTIFICATION_EXIT_TREE: { @@ -78,6 +83,14 @@ void CollisionObject3D::_notification(int p_what) { _update_pickable(); } break; +#ifdef TOOLS_ENABLED + case NOTIFICATION_LOCAL_TRANSFORM_CHANGED: { + if (Engine::get_singleton()->is_editor_hint()) { + update_configuration_warnings(); + } + } break; +#endif + case NOTIFICATION_TRANSFORM_CHANGED: { if (only_update_transform_changes) { return; @@ -724,6 +737,11 @@ PackedStringArray CollisionObject3D::get_configuration_warnings() const { warnings.push_back(RTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape3D or CollisionPolygon3D as a child to define its shape.")); } + Vector3 scale = get_transform().get_basis().get_scale(); + if (!(Math::is_zero_approx(scale.x - scale.y) && Math::is_zero_approx(scale.y - scale.z))) { + warnings.push_back(RTR("With a non-uniform scale this node will probably not function as expected.\nPlease make its scale uniform (i.e. the same on all axes), and change the size in children collision shapes instead.")); + } + return warnings; } |