From dd1a7cf2d8ce7bef1744f5a8cae5475104ea5438 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 10 Feb 2020 00:07:37 +0200 Subject: [PATCH] Fix euler angle calculation in Transform --- source/transform.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.45.2