Forum Discussion

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

Disabling mouse rotation affect on headset

Apologies if there is an obvious solution to this.
I believed I thoroughly searched these forums as well as looked through all the scripts that came with the Unity Integration but have been unable to find anything that will allow me to simple disable the the mouse from affecting the rotation of the headset. Can someone please point me in the right direction?

Thanks in Advance!


4 Replies

Replies have been turned off for this discussion
  • drash's avatar
    drash
    Heroic Explorer
    I'm assuming you're referring to the OVRPlayerController. If so, there's a simple solution (at least as far as I know in SDK 0.2.5c). Edit the OVRPlayerController script, and around line 78 or so line the code that says this:

    private bool  AllowMouseRotation      = true;

    And change that to false, then Save. And that should do it. If you wanted to toggle this at runtime, you can call the OVRPlayerController's SetAllowMouseRotation(bool) function at any time.
  • "drash" wrote:
    I'm assuming you're referring to the OVRPlayerController. If so, there's a simple solution (at least as far as I know in SDK 0.2.5c). Edit the OVRPlayerController script, and around line 78 or so line the code that says this:

    private bool  AllowMouseRotation      = true;

    And change that to false, then Save. And that should do it. If you wanted to toggle this at runtime, you can call the OVRPlayerController's SetAllowMouseRotation(bool) function at any time.



    This was actually the first thing I did/tried.
    I searched through all the ovr scripts for
    The word mouse and found the line of
    Code you referenced above. It seems quite
    Self explanatory and easy to do I thought. So
    I set the variable to false the same as you suggested
    but it had no effect.

    I tried it several times, confirned saving
    The script, reopened unity and confirmed
    again it was false but still no effect. The mouse
    Continues to stubbornly move the rotation
    of the head set once in game view.

    I thought maybe there was so other setting or
    overide but could find nothing.

    I'm actually really surprised that I don't see
    more people interested in doing this.
    In fact I don't understand why the mouse effect on the
    Headset rotation isn't disabled by default.
  • I found a solution. In the UpdateMovement() method of OVRPlayerController I had to change this following line of code:
    deltaRotation = Input.GetAxis("Mouse X") * rotateInfluence * 0.0f; // originally rotateInfluence was multiplied by 3.25f  


    This stopped the mouse from having any effect on the head rotation.
  • budhi15's avatar
    budhi15
    Honored Guest
    Thanks. This helped me as well. Should've thought of it earlier though. I hope Oculus knows about this that setting AllowMouseRotation to false doesn't do anything.