# How to check if player is rapidly rotating the joystick?

Currently working on a game that needs a check to see if the player is rotating the joystick around in a circular motion. That is, they are quickly rotating it around a few times, like spinning a spinner. The first major example that comes to my head is in the old Paper Mario game in which you twirl the joystick around a few times to flip your character around to get into small spaces. I thought of doing a check to see if the player inputs a certain direction, and then within a timer checking to see if they input the “next” direction (downleft if they had previously put in down) etc… a few times, but this just seems like a really inefficient way to do this. Any better methods out there? Any help would be greatly appreciated!

I’m need similiar so I try making;

from the basic

``````    public float deltaY;
public float deltaX;
float oldX;
float oldY;
public int rotatecount;
public float MinRotSpd;
Vector2 inputdirect;
void Update()
{

float deltaValuex = Input.GetAxisRaw("Horizontal") - oldX;
float deltaValuey = Input.GetAxisRaw("Vertical") - oldY;
oldX = Input.GetAxisRaw("Horizontal");
oldY = Input.GetAxisRaw("Vertical");
if(Mathf.Abs(deltaValuex) < MinRotSpd && Mathf.Abs(deltaValuey) < MinRotSpd)
{
rotatecount = 0;
inputdirect = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
}
if (Mathf.Abs(deltaValuex) >= MinRotSpd || Mathf.Abs(deltaValuey) >= MinRotSpd)
{
inputdirect = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
if (Input.GetAxisRaw("Horizontal") == inputdirect.x && Input.GetAxisRaw("Vertical") == inputdirect.y)
{
rotatecount += 1;
}
if(rotatecount >= 2)
{
//place here your action if you like work similar to super mario odyssey
DoSpin();
}
//or palace here if you like instant
}
}
void DoSpin()
{
//action
}
``````

I hope helped this