From 8c8e84b6b1afc47a4c44c81c3d698fa71e4853fd Mon Sep 17 00:00:00 2001 From: Dunbaratu Date: Thu, 26 Jun 2014 15:21:38 -0500 Subject: [PATCH 1/2] Resolves #154 - Now :VECTOR suffix will work on all types of Direction. --- src/Suffixed/Direction.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Suffixed/Direction.cs b/src/Suffixed/Direction.cs index d2689eb1d..537eac91f 100644 --- a/src/Suffixed/Direction.cs +++ b/src/Suffixed/Direction.cs @@ -18,6 +18,7 @@ public Direction(Quaternion q) { rotation = q; euler = q.eulerAngles; + vector = rotation * Vector3d.forward; } public Direction(Vector3d v3D, bool isEuler) @@ -50,6 +51,7 @@ public Vector3d Euler { euler = value; rotation = Quaternion.Euler(value); + vector = rotation * Vector3d.forward; } } @@ -60,6 +62,7 @@ public Quaternion Rotation { rotation = value; euler = value.eulerAngles; + vector = rotation * Vector3d.forward; } } From 44db83effebaf5785957563decc519dba45d7eec Mon Sep 17 00:00:00 2001 From: Dunbaratu Date: Thu, 26 Jun 2014 22:41:35 -0500 Subject: [PATCH 2/2] made all vectors unit vectors in Direction, for consistency. --- src/Suffixed/Direction.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Suffixed/Direction.cs b/src/Suffixed/Direction.cs index 537eac91f..edc2385b7 100644 --- a/src/Suffixed/Direction.cs +++ b/src/Suffixed/Direction.cs @@ -38,7 +38,7 @@ public Vector3d Vector get { return vector; } set { - vector = value; + vector = value.normalized; rotation = Quaternion.LookRotation(value); euler = rotation.eulerAngles; }