1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

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.
This commit is contained in:
Ferenc Arn
2016-10-18 15:50:21 -05:00
parent f2e99826c0
commit bd7ba0b664
16 changed files with 211 additions and 135 deletions

View File

@@ -103,13 +103,13 @@ void GridMapEditor::_menu_option(int p_option) {
if (input_action==INPUT_DUPLICATE) {
r.set_orthogonal_index(selection.duplicate_rot);
r.rotate(Vector3(0,1,0),Math_PI/2.0);
r.rotate(Vector3(0,1,0),-Math_PI/2.0);
selection.duplicate_rot=r.get_orthogonal_index();
_update_duplicate_indicator();
break;
}
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0,1,0),Math_PI/2.0);
r.rotate(Vector3(0,1,0),-Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
@@ -118,14 +118,14 @@ void GridMapEditor::_menu_option(int p_option) {
if (input_action==INPUT_DUPLICATE) {
r.set_orthogonal_index(selection.duplicate_rot);
r.rotate(Vector3(1,0,0),Math_PI/2.0);
r.rotate(Vector3(1,0,0),-Math_PI/2.0);
selection.duplicate_rot=r.get_orthogonal_index();
_update_duplicate_indicator();
break;
}
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(1,0,0),Math_PI/2.0);
r.rotate(Vector3(1,0,0),-Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
@@ -134,35 +134,35 @@ void GridMapEditor::_menu_option(int p_option) {
if (input_action==INPUT_DUPLICATE) {
r.set_orthogonal_index(selection.duplicate_rot);
r.rotate(Vector3(0,0,1),Math_PI/2.0);
r.rotate(Vector3(0,0,1),-Math_PI/2.0);
selection.duplicate_rot=r.get_orthogonal_index();
_update_duplicate_indicator();
break;
}
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0,0,1),Math_PI/2.0);
r.rotate(Vector3(0,0,1),-Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_Y: {
Matrix3 r;
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0,1,0),-Math_PI/2.0);
r.rotate(Vector3(0,1,0),Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_X: {
Matrix3 r;
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(1,0,0),-Math_PI/2.0);
r.rotate(Vector3(1,0,0),Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;
case MENU_OPTION_CURSOR_BACK_ROTATE_Z: {
Matrix3 r;
r.set_orthogonal_index(cursor_rot);
r.rotate(Vector3(0,0,1),-Math_PI/2.0);
r.rotate(Vector3(0,0,1),Math_PI/2.0);
cursor_rot=r.get_orthogonal_index();
_update_cursor_transform();
} break;