Animate go rotation on input in continuous

Trying to rotate round game object 90 degree on each input, after one round rotation no longer happening 90 degree rotation.

Maybe If I’m guessing this is because of
Euler angles are specified in degrees in the interval (-360, 360)
I don’t know.

function on_input(self, action_id, action)
	if action_id == hash("key_right") then
		if action.pressed then
			self.globe_angle = self.globe_angle - 90
			
			go.animate(".", "euler.z", go.PLAYBACK_ONCE_FORWARD, self.globe_angle, go.EASING_INCUBIC, 1, 0, function()
				
			end)
		end

This is what I’m trying to achieve round menu. If someone can break tips for creating something like this(bottom video clip). Specially how input handing is happening here. If it’s only swipe then it can be done easily. But I’m finding their is drag movement also.

Hello, ah looks like by subtracting 90 deg eventually the angle surpasses 360 and becomes 450,540 etc. When needed should reset the angle back to 0.

2 Likes

Here’s an example codepad of resetting the angle back to zero after every full turn:

https://defold.com/codepad/#?c=#cp_sprite&s1=GYVwdgxgLglg9mABDMMoAoDOBTANsASgCgBIAW0wHMA6ABzkwwCJqmAaRJgQwgEcQYAJ2wB9FLRBQRwOBBCYmxEjnzVKuOACNRXMOuyIAvIgAMRbGAAmRIqEiwEiBGLASMK4Bx4OwYy1+h4MGJEUORgRG8gvyNjAAsuTDj0JjI4eVFNSShnXGxgKEVIq0jAhDphTBxLRCg4iyIwpvDEDzUNbRFdfVjEAFoAZgA2E1r6sEbmqbb1LR09PKNTSammyjhqHGZWDiZsEDzBagAvdla8YHa5roXsENWLa1Xz1VnO7sXjGY75nr7EACcZme62ouhgZC4UGwKR2nH2hxOZ1BAAUADIAQQAmgAhDEAYQA0iIAPIAOXxAFERAAxEkAJQA6hj6QARDjfa4fbAcUGUjEAZQAkmSAOIiEX4gCqOKF+I4AEYOCZ7qFHuYrEA=

4 Likes