diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-09-04 07:48:14 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-09-04 07:49:42 -0300 |
commit | 6d233c651b21ecaef78fbb20d0365a22919b72b1 (patch) | |
tree | a8be9cc8446853e7d0ad5a017ce4916145175a23 /core/math/transform.cpp | |
parent | 3873362b3df0c1c03746225f8e43b629bd0864cc (diff) | |
download | redot-engine-6d233c651b21ecaef78fbb20d0365a22919b72b1.tar.gz |
-Changed KinematicBody API yet again to make it friendlier
-Fixed get_scale functions (and added set_scale) to make it more coherent when decomposing and composing (fixes bugs in transform interpolation)
Diffstat (limited to 'core/math/transform.cpp')
-rw-r--r-- | core/math/transform.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/math/transform.cpp b/core/math/transform.cpp index 60df69a509..638a39ab73 100644 --- a/core/math/transform.cpp +++ b/core/math/transform.cpp @@ -118,17 +118,17 @@ Transform Transform::interpolate_with(const Transform &p_transform, real_t p_c) /* not sure if very "efficient" but good enough? */ - Vector3 src_scale = basis.get_scale(); - Quat src_rot = basis; + Vector3 src_scale = basis.get_signed_scale(); + Quat src_rot = basis.orthonormalized(); Vector3 src_loc = origin; - Vector3 dst_scale = p_transform.basis.get_scale(); + Vector3 dst_scale = p_transform.basis.get_signed_scale(); Quat dst_rot = p_transform.basis; Vector3 dst_loc = p_transform.origin; - Transform dst; - dst.basis = src_rot.slerp(dst_rot, p_c); - dst.basis.scale(src_scale.linear_interpolate(dst_scale, p_c)); + Transform dst; //this could be made faster by using a single function in Basis.. + dst.basis = src_rot.slerp(dst_rot, p_c).normalized(); + dst.basis.set_scale(src_scale.linear_interpolate(dst_scale, p_c)); dst.origin = src_loc.linear_interpolate(dst_loc, p_c); return dst; |