diff options
author | Ferenc Arn <tagcup@yahoo.com> | 2016-10-18 15:50:21 -0500 |
---|---|---|
committer | Ferenc Arn <tagcup@yahoo.com> | 2017-01-03 17:41:04 -0600 |
commit | bd7ba0b664fa98381db9ef8edb69ba211213d595 (patch) | |
tree | 8e313066ce55a3366cd6b972ff429372583cda28 /scene/3d/character_camera.cpp | |
parent | f2e99826c0b1e8227644bfab0795d858c504d279 (diff) | |
download | redot-engine-bd7ba0b664fa98381db9ef8edb69ba211213d595.tar.gz |
Use right handed coordinate system for rotation matrices and quaternions. Also fixes Euler angles (XYZ convention, which is used as default by Blender).
Furthermore, functions which expect a rotation matrix will now give an error simply, rather than trying to orthonormalize such matrices. The documentation for such functions has be updated accordingly.
This commit breaks code using 3D rotations, and is a part of the breaking changes in 2.1 -> 3.0 transition. The code affected within Godot code base is fixed in this commit.
Diffstat (limited to 'scene/3d/character_camera.cpp')
-rw-r--r-- | scene/3d/character_camera.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/scene/3d/character_camera.cpp b/scene/3d/character_camera.cpp index e8b7759a98..b4cd46bd35 100644 --- a/scene/3d/character_camera.cpp +++ b/scene/3d/character_camera.cpp @@ -255,8 +255,8 @@ void CharacterCamera::_compute_camera() { orbit.x=max_orbit_x; Matrix3 m; - m.rotate(Vector3(0,1,0),Math::deg2rad(orbit.y)); - m.rotate(Vector3(1,0,0),Math::deg2rad(orbit.x)); + m.rotate(Vector3(0,1,0),-Math::deg2rad(orbit.y)); + m.rotate(Vector3(1,0,0),-Math::deg2rad(orbit.x)); new_pos = (m.get_axis(2) * distance) + character_pos; @@ -432,8 +432,8 @@ void CharacterCamera::set_orbit(const Vector2& p_orbit) { float d = char_pos.distance_to(follow_pos); Matrix3 m; - m.rotate(Vector3(0,1,0),orbit.y); - m.rotate(Vector3(1,0,0),orbit.x); + m.rotate(Vector3(0,1,0),-orbit.y); + m.rotate(Vector3(1,0,0),-orbit.x); follow_pos=char_pos + m.get_axis(2) * d; @@ -475,8 +475,8 @@ void CharacterCamera::rotate_orbit(const Vector2& p_relative) { if (type == CAMERA_FOLLOW && is_inside_scene()) { Matrix3 m; - m.rotate(Vector3(0,1,0),Math::deg2rad(p_relative.y)); - m.rotate(Vector3(1,0,0),Math::deg2rad(p_relative.x)); + m.rotate(Vector3(0,1,0),-Math::deg2rad(p_relative.y)); + m.rotate(Vector3(1,0,0),-Math::deg2rad(p_relative.x)); Vector3 char_pos = get_global_transform().origin; char_pos.y+=height; |