From ecc8aedd3bb5978c298d5c6588463f6d4757ad11 Mon Sep 17 00:00:00 2001 From: w0wca7a <154334645+w0wca7a@users.noreply.github.com> Date: Thu, 14 May 2026 21:45:38 +0300 Subject: [PATCH 1/2] Update TransformationGizmo.cs Gizmo fix: Scene.Offset --- .../Gizmos/TransformationGizmo.cs | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/sources/editor/Stride.Assets.Presentation/AssetEditors/Gizmos/TransformationGizmo.cs b/sources/editor/Stride.Assets.Presentation/AssetEditors/Gizmos/TransformationGizmo.cs index 119b63f8a6..8d5fff45a4 100644 --- a/sources/editor/Stride.Assets.Presentation/AssetEditors/Gizmos/TransformationGizmo.cs +++ b/sources/editor/Stride.Assets.Presentation/AssetEditors/Gizmos/TransformationGizmo.cs @@ -192,10 +192,20 @@ private Matrix GetWorldMatrix(IEditorGameCameraService cameraService) worldMatrix.TranslationVector = AnchorEntity.Transform.WorldMatrix.TranslationVector; break; case TransformationSpace.ObjectSpace: - var parentMatrix = Matrix.Identity; + Matrix parentMatrix; if (AnchorEntity.GetParent() != null) + { parentMatrix = AnchorEntity.TransformValue.Parent.WorldMatrix; - + } + else + { + // Root entity in subscene — use Scene.Offset as parent matrix + var scene = AnchorEntity.Scene; + parentMatrix = (scene != null && scene.Offset != Vector3.Zero) + ? Matrix.Translation(scene.Offset) + : Matrix.Identity; + } + // We don't use the entity's "WorldMatrix" because its scale could be zero, which would break the gizmo. worldMatrix = Matrix.RotationQuaternion(AnchorEntity.Transform.Rotation) * Matrix.Translation(AnchorEntity.Transform.Position) * @@ -335,6 +345,19 @@ protected virtual void OnTransformationStarted(Vector2 mouseDragPixel) // Ensure world matrix is computed entity.Transform.UpdateWorldMatrix(); + Matrix inverseParent; + if (entity.Transform.Parent != null) + { + inverseParent = Matrix.Invert(entity.Transform.Parent.WorldMatrix); + } + else + { + var scene = entity.Scene; + inverseParent = (scene != null && scene.Offset != Vector3.Zero) + ? Matrix.Invert(Matrix.Translation(scene.Offset)) + : Matrix.Identity; + } + InitialTransformations[entity] = new InitialTransformation { Scale = entity.Transform.Scale, From d5b1f5166e914510cc089489105200af1fc67da0 Mon Sep 17 00:00:00 2001 From: w0wca7a <154334645+w0wca7a@users.noreply.github.com> Date: Thu, 14 May 2026 21:49:15 +0300 Subject: [PATCH 2/2] Update TransformationGizmo.cs fix Initial Transformations --- .../AssetEditors/Gizmos/TransformationGizmo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/editor/Stride.Assets.Presentation/AssetEditors/Gizmos/TransformationGizmo.cs b/sources/editor/Stride.Assets.Presentation/AssetEditors/Gizmos/TransformationGizmo.cs index 8d5fff45a4..16e2588082 100644 --- a/sources/editor/Stride.Assets.Presentation/AssetEditors/Gizmos/TransformationGizmo.cs +++ b/sources/editor/Stride.Assets.Presentation/AssetEditors/Gizmos/TransformationGizmo.cs @@ -363,7 +363,7 @@ protected virtual void OnTransformationStarted(Vector2 mouseDragPixel) Scale = entity.Transform.Scale, Translation = entity.Transform.Position, Rotation = entity.Transform.Rotation, - InverseParentMatrix = entity.Transform.Parent != null ? Matrix.Invert(entity.Transform.Parent.WorldMatrix) : Matrix.Identity + InverseParentMatrix = inverseParent }; } }