# Detecting Circular Motion

im really stuck on this one, im making a vr game, and i need to regignize if the player is stirring the cauldren.

This is ancient but jic someone else needs some info in the future:

You should be able to detect circular motion by picking a point and axis to rotate around, getting a vector between the controller and the rotation reference point, projecting that vector onto the rotation axis, and then getting the cross product from the current and previous hand>rotation reference point vector to see if it’s a clockwise or counter clockwise rotation.

Quick psuedocode:

Vector3 curDir = rotRef - controllerPos
CurDir = vector3.projectonNormal(curAngle, rotAxis)

Vector3 cross = vector3.cross(curDir, lastDir)
Float direction = vector3.dot(cross,rotAxis)

Float angleDifference = vector3.angle(curDir, lastDir)
AngleDifference *= mathf.sign(direction)

TotalAngle+=angleDifference

Then you can use angleDifference to figure out how many stirs the player has done by saying like

NumStirs = totalAngle/360