Search Unity

Track whether hand controller is turning clockwise or counter-clockwise

Discussion in 'Scripting' started by MiaoBolverk, Apr 25, 2018.

  1. MiaoBolverk

    MiaoBolverk

    Joined:
    Feb 6, 2018
    Posts:
    26
    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
    1. once the user grabs the key, and
    2. 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.
     
  2. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,528
  3. MiaoBolverk

    MiaoBolverk

    Joined:
    Feb 6, 2018
    Posts:
    26
    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:
    Code (csharp):
    1. Debug.Log(Input.gyro.rotationRate.x);
    "0" is printed every single time, even when I am rotating the Oculus hand controller.
     
    Last edited: Apr 25, 2018