From f01dcc64dae26aee5228ef85b5b3256b576bc56a Mon Sep 17 00:00:00 2001 From: GaN <2954687163@qq.com> Date: Mon, 4 Nov 2024 19:40:26 +0800 Subject: [PATCH 1/2] [EasyPositionEdit] Fix incorrect local coordinate calculation --- .../EasyPositionEdit/EasyPositionEditSceneMonitor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Editor/PropertyEditor/EasyPositionEdit/EasyPositionEditSceneMonitor.cs b/Editor/PropertyEditor/EasyPositionEdit/EasyPositionEditSceneMonitor.cs index 951f465..f55d1e1 100644 --- a/Editor/PropertyEditor/EasyPositionEdit/EasyPositionEditSceneMonitor.cs +++ b/Editor/PropertyEditor/EasyPositionEdit/EasyPositionEditSceneMonitor.cs @@ -83,7 +83,7 @@ private static void OnDuringSceneGUI(SceneView sceneView) (var worldPosition, var label) = positionData.positionType switch { PositionType.World => (positionData.position, "World Position"), - PositionType.Local => (target.TransformPoint(positionData.position), "Local Position"), + PositionType.Local => (target.parent ? target.parent.TransformPoint(positionData.position) : positionData.position, "Local Position"), PositionType.WorldRelative => (target.position + positionData.position, "World Relative Position"), PositionType.LocalRelative => (target.TransformPoint(target.localPosition + positionData.position), "Local Relative Position"), _ => (Vector3.zero, "Unknown Position Type") @@ -95,7 +95,7 @@ private static void OnDuringSceneGUI(SceneView sceneView) positionData.position = positionData.positionType switch { PositionType.World => newPosition, - PositionType.Local => target.InverseTransformPoint(newPosition), + PositionType.Local => target.parent ? target.parent.InverseTransformPoint(newPosition) : newPosition, PositionType.WorldRelative => newPosition - target.position, PositionType.LocalRelative => target.InverseTransformPoint(newPosition) - target.localPosition, _ => Vector3.zero From 151aae8d74bbd1925842107ccffc49fd001f7f1a Mon Sep 17 00:00:00 2001 From: GaN <2954687163@qq.com> Date: Mon, 4 Nov 2024 19:53:44 +0800 Subject: [PATCH 2/2] Fix again --- .../EasyPositionEdit/EasyPositionEditSceneMonitor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Editor/PropertyEditor/EasyPositionEdit/EasyPositionEditSceneMonitor.cs b/Editor/PropertyEditor/EasyPositionEdit/EasyPositionEditSceneMonitor.cs index f55d1e1..77b5c81 100644 --- a/Editor/PropertyEditor/EasyPositionEdit/EasyPositionEditSceneMonitor.cs +++ b/Editor/PropertyEditor/EasyPositionEdit/EasyPositionEditSceneMonitor.cs @@ -85,7 +85,7 @@ private static void OnDuringSceneGUI(SceneView sceneView) PositionType.World => (positionData.position, "World Position"), PositionType.Local => (target.parent ? target.parent.TransformPoint(positionData.position) : positionData.position, "Local Position"), PositionType.WorldRelative => (target.position + positionData.position, "World Relative Position"), - PositionType.LocalRelative => (target.TransformPoint(target.localPosition + positionData.position), "Local Relative Position"), + PositionType.LocalRelative => (target.TransformPoint(positionData.position), "Local Relative Position"), _ => (Vector3.zero, "Unknown Position Type") }; @@ -97,7 +97,7 @@ private static void OnDuringSceneGUI(SceneView sceneView) PositionType.World => newPosition, PositionType.Local => target.parent ? target.parent.InverseTransformPoint(newPosition) : newPosition, PositionType.WorldRelative => newPosition - target.position, - PositionType.LocalRelative => target.InverseTransformPoint(newPosition) - target.localPosition, + PositionType.LocalRelative => target.InverseTransformPoint(newPosition), _ => Vector3.zero }; }