Forum Discussion

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

Mouse-look during development

Probably a silly question, but how do you enable mouse-look when developing GearVR apps on a PC?

I can get things working on the GearVR, but I want to test gameplay on my PC without rebuilding and installing an APK with every change I make. :D

Is there a fast way to iterate, when you don't have a DK2?

9 Replies

Replies have been turned off for this discussion
  • I think the current method for testing on PC is with the DK2 headset.
  • With the dk2 i've set up a mouse look script that will only activate when using the editor so that i dont always have to put on the headset when testing, something like this should work for gear.

    Just use something like
    #!if UNITY_EDITOR
    mouselookscript.enabled = false
    #endif
  • dnhkng's avatar
    dnhkng
    Honored Guest
    Thanks MikeF, that looks like what I need.


    I found a script in the Standard Character assets called SimpleMouseRotator which I can add to the main camera. Which script do I add the following code to?

    #!if UNITY_EDITOR
    SimpleMouseRotator.enabled = false
    #endif



    Also, should I be using the main camera that in a new project, or should I be using the Oculus utility stuff? its hard to tell from the documentation. I am targeting the GearVR.

    -David
  • Here is a script that I wrote (mostly borrowed from the Google Cardboard SDK for Unity).

    ALT+mouse move will pitch (Y) and yaw (X)
    CTRL+mouse move will roll (Z)

    There are settings to automatically recenter both the Y & Z axis so I can still use the DK2 easily.

    If you aren't in VR mode (and don't have a DK2 plugged in) then you can drag this script directly onto your camera. But I use it with the DK2, so in that case follow these instructions:

    For Unity 5 VR: I insert a gameobject in the hierarchy between the main camera and it's parent. Then add this script to that game object.

    For Oculus VR: Drag VRMouseLook onto your OVRCameraRig (child of OVRPlayerController) and uncheckmark the "Enable Yaw" as the Oculus controller will already do that.

    HTH

    Peter
  • dnhkng's avatar
    dnhkng
    Honored Guest
    Tested it, and it looks great! thanks!

    Then I went over to you blog, and found great info there too :D

    Do you use the native Unity VR support or OVRCameraRig? I'm not sure I know what the difference is, but I would like to use the GearVR touchpad.
  • Great, glad that worked for you!

    For native vs OVRCameraRig I use a bit of both, depending on the app and how broken Unity is (which is getting much better lately).

    Neither has an impact on using the GearVR touchpad though:

    For the touchpad, depending on what you want to do, you can use the Oculus OVRTouchpad (in mobile SDK) if you want swipe gestures, or if you want full control then you will see the touchpad is just a standard single button mouse input, so you can directly use Input.mousePosition, Input.GetMouseButtonUp/Down(0) (or map it in the Input Manager if your input is simple).
  • Hey @dnhkng, one caveat I should mention:

    That script does not implement a head-neck model, so it is not exactly what the user in a GearVR would see because this only pivots around the center of the game object.

    Just thought I should let you know!