From cc3568da14459150a229d80ff42b44a26a558df6 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 17 May 2021 17:44:38 +0900 Subject: [PATCH] Inverse --- Assets/VRM10/Runtime/Components/Constraint/TR.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Assets/VRM10/Runtime/Components/Constraint/TR.cs b/Assets/VRM10/Runtime/Components/Constraint/TR.cs index 14466898f..7a393f267 100644 --- a/Assets/VRM10/Runtime/Components/Constraint/TR.cs +++ b/Assets/VRM10/Runtime/Components/Constraint/TR.cs @@ -36,5 +36,11 @@ namespace UniVRM10 public Matrix4x4 TRS(float s) => Matrix4x4.TRS(Translation, Rotation, new Vector3(s, s, s)); public static TR operator *(TR a, TR b) => new TR(a.Rotation * b.Rotation, a.Rotation * b.Translation + a.Translation); + + public TR Inverse() + { + var inv = Quaternion.Inverse(Rotation); + return new TR(inv, inv * Translation); + } } }