Search Unity

when the control twisted THEN ROTATE slow ??

Discussion in 'Scripting' started by mauricito4, Oct 29, 2019.

  1. mauricito4

    mauricito4

    Joined:
    May 12, 2013
    Posts:
    120
    Hello,
    Any idea how to do, so that when turning the control of the oculus go, at the same time turn a GAMEOBJECT?
    but three times slower?
    or smooth slower please ?

    I leave the picture of what I need.
    I don't have any script yet.
    I need help. please.
    thanks a thousand!
    .
    upload_2019-10-29_16-12-36.png
     
  2. ergin3d

    ergin3d

    Joined:
    Jul 31, 2015
    Posts:
    30
    I think you need to get controller rotation as Quaternion with :
    Code (CSharp):
    1. ContollerRotationQ = OVRInput.GetLocalControllerRotation(activeController);
    then set the rotation of your object with Quaternion.Lerp
    Code (CSharp):
    1. object1.rotation = Quaternion.Lerp(object1.rotation, ContollerRotationQ, Time.time * speed);
    This should work fine with small speed float values such as 0.001f
     
  3. mauricito4

    mauricito4

    Joined:
    May 12, 2013
    Posts:
    120
    thanks really thanks ....
    ..
    question....
    if I twist the oculus control enough hard.... the cube will rotate in the same direction, and faster?
    and on the contrary ...
    if I have it slightly soft a little bit, will the cube rotate slowly smooth ?
    is that so?
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Try it.
     
    Antypodish likes this.