Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
di3ension's avatar
di3ension
Honored Guest
12 years ago

Rotate OVR player with key input

I saw another post in the reporting issues thread but with no answer, so i thought the unity integration thread is the right place for this. With the old sdk i could rotate my ovr player by keyinput with Q and E, which is essential for me because we use a single thumbstick controler to move arround in the rift demos. But now with the new sdk there is no smooth rotation possible with Q and E. It is more like jumping to differnt angles. :(

9 Replies

Replies have been turned off for this discussion
  • Can you map your controller's input to the Mouse X or an XInput axis? That should still give you continuous rotation.
  • Unfortunately not, i have already tried to remap the stick. It would be interesting to know, what happened with the old q and e rotation and why it doesn't work anymore.
  • grancia's avatar
    grancia
    Honored Guest
    You can rotate camera smoothly with changing code located the "line 315" in "OVRPlayerController.cs" like below.

    //Use keys to ratchet rotation
    // the variable "0.1f" is for managing rotation speed and you can define it by yourself.
    if (Input.GetKey(KeyCode.Q))
    YRotation -= RotationRatchet * 0.1f;
    if (Input.GetKey(KeyCode.E))
    YRotation += RotationRatchet * 0.1f;
  • Thx for the input, i am quite a scripting noob. The problem is, when i change the values it is still a ratchet rotation. I need a smooth roation like in the old sdk.
  • For some reason I had a ton of issues turning the OVR for rotation or movement along waypoints. One approach that worked great for me was no longer rotating the OVR. Instead, I have an object (say a cube) that isn't rendering, the OVR is a child of this, and all movement is on this parent object. I now see the results I expect, without mucking up the OVR.
  • "di3ension" wrote:
    It would be interesting to know, what happened with the old q and e rotation and why it doesn't work anymore.

    Continuous keyboard rotation was causing nausea in our tests. However, we still support continuous gamepad rotation. Since you're not using an XBox controller, it will require a small code change. You can add Input.GetAxis("MyThumbAxis") to the following value in OVRPlayerController.UpdateMovement():

    float leftAxisX =
    OVRGamepadController.GPC_GetAxis((int)OVRGamepadController.Axis.LeftXAxis);
  • Is it possible to move forward and back by mouse input using the y axis? That would be great because i have a mouse mapping for our controller.

    i tried adding

    // Move
    if (Input.GetAxis("Mouse Y")<0) moveBack =true;
    if (Input.GetAxis("Mouse Y")>0) moveForward =true;
  • grancia's avatar
    grancia
    Honored Guest
    "di3ension" wrote:
    Thx for the input, i am quite a scripting noob. The problem is, when i change the values it is still a ratchet rotation. I need a smooth roation like in the old sdk.


    Please make sure you use Input.GetKey, not Input.GetKeyDown.
  • As you can see, a real script noob :D! Thanks alot, everything works out perfect again !!