Skip to content

Commit 1afe596

Browse files
author
David Kline
authored
Merge pull request #3717 from keveleigh/mixedrealitypose-properties
Add useful properties to MixedRealityPose
2 parents 14dedfc + 2ec8315 commit 1afe596

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Assets/MixedRealityToolkit/Definitions/Utilities/MixedRealityPose.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,21 @@ public MixedRealityPose(Quaternion rotation)
5050
public static MixedRealityPose ZeroIdentity { get; } = new MixedRealityPose(Vector3.zero, Quaternion.identity);
5151

5252
[SerializeField]
53+
[Tooltip("The position of the pose")]
5354
private Vector3 position;
5455

56+
/// <summary>
57+
/// The position of the pose.
58+
/// </summary>
5559
public Vector3 Position { get { return position; } set { position = value; } }
5660

5761
[SerializeField]
62+
[Tooltip("The rotation of the pose.")]
5863
private Quaternion rotation;
5964

65+
/// <summary>
66+
/// The rotation of the pose.
67+
/// </summary>
6068
public Quaternion Rotation { get { return rotation; } set { rotation = value; } }
6169

6270
public static MixedRealityPose operator +(MixedRealityPose left, MixedRealityPose right)
@@ -79,6 +87,21 @@ public override string ToString()
7987
return $"{position} | {rotation}";
8088
}
8189

90+
/// <summary>
91+
/// The Z axis of the pose in world space.
92+
/// </summary>
93+
public Vector3 Forward => rotation * Vector3.forward;
94+
95+
/// <summary>
96+
/// The Y axis of the pose in world space.
97+
/// </summary>
98+
public Vector3 Up => rotation * Vector3.up;
99+
100+
/// <summary>
101+
/// The X axis of the pose in world space.
102+
/// </summary>
103+
public Vector3 Right => rotation * Vector3.right;
104+
82105
#region IEqualityComparer Implementation
83106

84107
bool IEqualityComparer.Equals(object left, object right)

0 commit comments

Comments
 (0)