diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-03 23:20:20 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-03 23:20:20 -0300 |
commit | 3a0c19d3f6ddb26359c95d84c376a8e6b1afd04d (patch) | |
tree | 8e313066ce55a3366cd6b972ff429372583cda28 /scene | |
parent | f2e99826c0b1e8227644bfab0795d858c504d279 (diff) | |
parent | bd7ba0b664fa98381db9ef8edb69ba211213d595 (diff) |
Merge pull request #6865 from tagcup/godot_issue_6816
Use right handed coordinate system for rotation matrices and quaternions. Also fixed Euler angles (XYZ convention).
Diffstat (limited to 'scene')
-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; |