Animate rotation strange behavior (SOLVED)

Hi all!
I do not understand the quaternions well, so maybe this is my mistake. In the course of experiments, I found that when animate “rotation” model (3D) scales down and back, proportional to the rotation angle.
Those at an angle of 30 degrees it’s almost imperceptible, and at 170 - it’s crazy.
Here’s code:

function Rotate(self)
	local rot=vmath.quat_rotation_y(math.rad(self.step))*go.get_rotation();
	go.animate(".", "rotation", go.PLAYBACK_ONCE_FORWARD, rot, go.EASING_LINEAR, self.rottime,0,Rotate);
end

I create 3 cubes with different “step” property (170, 90, 30) and get result as at screenshot.

And btw - how can I rotate object not around his axis but around world axis?

1 Like

go.animate() performs linear interpolation of the animated value. That means that if you put in a quaternion it will just linearly interpolate each component with no normalization. This results in artifacts like scaling. Use vmath.slerp() instead.

4 Likes

Thanks!
I’ll try it.

1 Like

Yes, it works. Very thanks!

3 Likes