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:
b1a9GoXDEO

However, an issue arises when you rotate clockwise:
bSWYS9Nyof
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:
image
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.

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

Boom. Exactly what I needed.

Thanks!

1 Like