1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

-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)
This commit is contained in:
Juan Linietsky
2017-09-04 07:48:14 -03:00
parent 3873362b3d
commit 6d233c651b
7 changed files with 197 additions and 118 deletions

View File

@@ -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;