Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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 Moderator

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