Преглед изворни кода

Merge pull request #51029 from lawnjelly/portals_gizmo_margins

Portals - fix gizmo margin scaling
Rémi Verschelde пре 4 година
родитељ
комит
78d9a4ae7e
1 измењених фајлова са 9 додато и 0 уклоњено
  1. 9 0
      scene/3d/portal.cpp

+ 9 - 0
scene/3d/portal.cpp

@@ -167,6 +167,15 @@ void Portal::_notification(int p_what) {
 		case NOTIFICATION_TRANSFORM_CHANGED: {
 			// keep the world points and the visual server up to date
 			portal_update();
+
+			// In theory we shouldn't need to update the gizmo when the transform
+			// changes .. HOWEVER, the portal margin is displayed in world space units,
+			// back transformed to model space.
+			// If the Z scale is changed by the user, the portal margin length can become incorrect
+			// and needs 'resyncing' to the global scale of the portal node.
+			// We really only need to do this when Z scale is changed, but it is easier codewise
+			// to always change it, unless we have evidence this is a performance problem.
+			update_gizmo();
 		} break;
 	}
 }