diff options
author | Ferenc Arn <tagcup@yahoo.com> | 2017-08-08 22:55:52 -0400 |
---|---|---|
committer | Ferenc Arn <tagcup@yahoo.com> | 2017-08-09 09:05:37 -0400 |
commit | 53c23b02226968d27e6caadcb801343697ac4fe9 (patch) | |
tree | f13f638959a7e1225cc87b09d6865f24e5bd7599 /core/math/matrix3.h | |
parent | 1536cc438128fe4036fa7da5ec305513a781d3c8 (diff) |
Use YXZ convention for Euler angles.
As discussed in issues #1479 and #9782, choosing the up axis (which is Y in Godot) as the axis of the last (or first) rotation is helpful in practical use cases.
This also aligns Godot's convention with Unity, helping with a smoother transition for people who are used to working with Unity (issue #9905).
Internally, both XYZ and YXZ functions are kept, for potential future applications.
Diffstat (limited to 'core/math/matrix3.h')
-rw-r--r-- | core/math/matrix3.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/math/matrix3.h b/core/math/matrix3.h index 8897c692f7..74e6564578 100644 --- a/core/math/matrix3.h +++ b/core/math/matrix3.h @@ -84,8 +84,13 @@ public: void set_rotation_euler(const Vector3 &p_euler); void set_rotation_axis_angle(const Vector3 &p_axis, real_t p_angle); - Vector3 get_euler() const; - void set_euler(const Vector3 &p_euler); + Vector3 get_euler_xyz() const; + void set_euler_xyz(const Vector3 &p_euler); + Vector3 get_euler_yxz() const; + void set_euler_yxz(const Vector3 &p_euler); + + Vector3 get_euler() const { return get_euler_yxz(); }; + void set_euler(const Vector3 &p_euler) { set_euler_yxz(p_euler); }; void get_axis_angle(Vector3 &r_axis, real_t &r_angle) const; void set_axis_angle(const Vector3 &p_axis, real_t p_phi); |