diff --git a/PCK-Studio/Internal/ModelPartSpecifics.cs b/PCK-Studio/Internal/ModelPartSpecifics.cs index 843b3f7c..f68400be 100644 --- a/PCK-Studio/Internal/ModelPartSpecifics.cs +++ b/PCK-Studio/Internal/ModelPartSpecifics.cs @@ -13,10 +13,10 @@ internal static class ModelPartSpecifics { ["HEAD"] = new PositioningInfo(), ["BODY"] = new PositioningInfo(), - ["ARM0"] = new PositioningInfo(new(-5f, 2f, 0f), new( 6f, 2f, 0f)), - ["ARM1"] = new PositioningInfo(new( 5f, 2f, 0f), new(-6f, 2f, 0f)), - ["LEG0"] = new PositioningInfo(new(-2f, 12f, 0f), new( 2f, 12f, 0f)), - ["LEG1"] = new PositioningInfo(new( 2f, 12f, 0f), new(-2f, 12f, 0f)), + ["ARM0"] = new PositioningInfo(new(-5f, 2f, 0f), new(-6f, 2f, 0f)), + ["ARM1"] = new PositioningInfo(new( 5f, 2f, 0f), new( 6f, 2f, 0f)), + ["LEG0"] = new PositioningInfo(new(-2f, 12f, 0f), new(-2f, 12f, 0f)), + ["LEG1"] = new PositioningInfo(new( 2f, 12f, 0f), new( 2f, 12f, 0f)), }; internal record struct PositioningInfo(Vector3 Translation, Vector3 Pivot); diff --git a/PCK-Studio/Rendering/CubeGroupMesh.cs b/PCK-Studio/Rendering/CubeGroupMesh.cs index 5b7acafc..8559bd2e 100644 --- a/PCK-Studio/Rendering/CubeGroupMesh.cs +++ b/PCK-Studio/Rendering/CubeGroupMesh.cs @@ -148,7 +148,7 @@ internal Vector3 GetCenter(int index) if (!cubes.IndexInRange(index)) throw new IndexOutOfRangeException(); - return Vector3.TransformPosition(cubes[index].Center + Offset, Transform); + return (Transform * Matrix4.CreateTranslation(cubes[index].Center)).ExtractTranslation(); } internal BoundingBox GetCubeBoundingBox(int index) diff --git a/PCK-Studio/Rendering/SkinRenderer.cs b/PCK-Studio/Rendering/SkinRenderer.cs index 3109a0bf..8a333803 100644 --- a/PCK-Studio/Rendering/SkinRenderer.cs +++ b/PCK-Studio/Rendering/SkinRenderer.cs @@ -863,7 +863,9 @@ internal void CenterSelectedObject() CubeGroupMesh cubeMesh = meshStorage[skinBox.Type]; Vector3 center = Cube.FromSkinBox(skinBox).Center; - Camera.FocalPoint = (cubeMesh.Transform * Matrix4.CreateTranslation(center)).Inverted().ExtractTranslation(); + Matrix4 camMat = (Matrix4.CreateTranslation(cubeMesh.Translation) * Matrix4.CreateTranslation(center) * Matrix4.CreateScale(-1, 1, 1)); + Vector3 camPos = camMat.ExtractTranslation(); + Camera.FocalPoint = camPos; Camera.Distance = skinBox.Size.Length() * 2; } }