Track whether hand controller is turning clockwise or counter-clockwise

In my scene, there is a key which the user may grab and then insert in various locks.

All of those locks can only be opened if the key is turned clockwise after insertion.

Let’s say that a fixed joint connects the key to the user hand

  • once the user grabs the key, and
  • until the key manages to open a lock (at which point the fixed joint will connect the key to the lock instead).

Does there already exist functionality in the Unity API that allows me to check whether the controller is being rotated clockwise or counter-clockwise?

If not, how can I accomplish that?

I am currently using the Oculus SDK.

I assume you’re talking about a VR controller.

The controller should have an accelerometer (linear motion) and a gyroscope (rotational motion).

Unity gives you access to both of these through Input, or you can use the oculus SDK to access it.

Here is unity’s gyroscope access point:

Note the ‘rotationRate’ value:

Thank you for your reply. Maybe I am missing something, I am still not sure how this helps me track whether the hand is rotating clockwise or counter-clockwise over a specified duration.

When I add the following line to my solution:

Debug.Log(Input.gyro.rotationRate.x);

“0” is printed every single time, even when I am rotating the Oculus hand controller.