Detecting the Direction of a Spin

Hi all,

I’ve been working on a system like Super Mario Odyssey’s spin move which detects spinning input (pressing WASD or WDSA in order rapidly) by doing a frame-by-frame analysis of the MoveDirection property. I’ve got a pretty robust implementation going that looks like this:

However, an issue arises when you rotate clockwise:
It’s difficult to see in the gif, but the animation shown does not rotate clockwise akin to the pick-up spinning motion; it rotates counter-clockwise. I currently use dot product to get the angle between the previous and current MoveDirection, but the dot product always returns a positive value for theta.

What I need is a trig. function that will give me the provided output:
I can handle the rest from there. Assume that each of the vectors shown above are unit vectors, too; MoveDirection is a unit vector.

Any help is appreciated!

Oh, for this use this function I found from AeroGameFramework this should give a sign to your vector angles stuff.

			Same as AngleBetween, but returns a signed value.
			v1 =, 0, 0)
			v2 =, 0, -10)
			axis =, 1, 0)
			AngleBetweenSigned(v1, v2, axis) == math.rad(90)

Boom. Exactly what I needed.


1 Like