diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-10 22:22:56 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-10 22:22:56 -0300 |
commit | 0acd4fccd566fdb074aebac01046b1e80c64b2dc (patch) | |
tree | defce0bc5663677db80fa6adfe7214b2ee10eac4 /core/math/transform.cpp | |
parent | 4338c9016347159d9562a5435e4c81afc21a362a (diff) | |
parent | 6b1252cdfa5988b77917518bc291a0cc34e5066e (diff) |
Merge pull request #7438 from tagcup/matrix3_rotate_fix
Fix the order in which additional transformations are applied
Diffstat (limited to 'core/math/transform.cpp')
-rw-r--r-- | core/math/transform.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/math/transform.cpp b/core/math/transform.cpp index 8516e4afcf..0dba121013 100644 --- a/core/math/transform.cpp +++ b/core/math/transform.cpp @@ -54,7 +54,8 @@ void Transform::invert() { } Transform Transform::inverse() const { - + // FIXME: this function assumes the basis is a rotation matrix, with no scaling. + // Transform::affine_inverse can handle matrices with scaling, so GDScript should eventually use that. Transform ret=*this; ret.invert(); return ret; @@ -63,12 +64,12 @@ Transform Transform::inverse() const { void Transform::rotate(const Vector3& p_axis,real_t p_phi) { - *this = *this * Transform( Matrix3( p_axis, p_phi ), Vector3() ); + *this = rotated(p_axis, p_phi); } Transform Transform::rotated(const Vector3& p_axis,real_t p_phi) const{ - return *this * Transform( Matrix3( p_axis, p_phi ), Vector3() ); + return Transform(Matrix3( p_axis, p_phi ), Vector3()) * (*this); } void Transform::rotate_basis(const Vector3& p_axis,real_t p_phi) { @@ -113,7 +114,7 @@ void Transform::set_look_at( const Vector3& p_eye, const Vector3& p_target, cons } -Transform Transform::interpolate_with(const Transform& p_transform, float p_c) const { +Transform Transform::interpolate_with(const Transform& p_transform, real_t p_c) const { /* not sure if very "efficient" but good enough? */ |