From: Mikko Rasa Date: Sun, 9 Feb 2020 22:07:37 +0000 (+0200) Subject: Fix euler angle calculation in Transform X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=dd1a7cf2d8ce7bef1744f5a8cae5475104ea5438;p=libs%2Fgl.git Fix euler angle calculation in Transform --- diff --git a/source/transform.cpp b/source/transform.cpp index 6862221b..b703a5b1 100644 --- a/source/transform.cpp +++ b/source/transform.cpp @@ -17,7 +17,7 @@ Transform Transform::from_matrix(const Matrix &matrix) trn.euler.z = Geometry::atan2(matrix(1, 0), matrix(0, 0)); Matrix m = Matrix::rotation(-trn.euler.z, Vector3(0.0f, 0.0f, 1.0f))*matrix; - trn.euler.y = Geometry::atan2(m(2, 0), m(0, 0)); + trn.euler.y = Geometry::atan2(-m(2, 0), m(0, 0)); m = Matrix::rotation(-trn.euler.y, Vector3(0.0f, 1.0f, 0.0f))*m; trn.euler.x = Geometry::atan2(m(2, 1), m(1, 1)); m = Matrix::rotation(-trn.euler.x, Vector3(1.0f, 0.0f, 0.0f))*m;