Forum Discussion
dnhkng
10 years agoHonored Guest
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?
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
- cyberealityGrand ChampionI think the current method for testing on PC is with the DK2 headset.
- MikeFTrusteeWith 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 - dnhkngHonored GuestThanks 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 - petereptProtegeHere 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 - dnhkngHonored GuestTested 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. - petereptProtegeGreat, 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). - petereptProtegeHey @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! - petereptProtegeI've updated that original script so that it works whether you have a DK2 or not plugged in.
I've posted it to my blog:
http://talesfromtherift.com/unity-vr-editor-mouse-look-script/ - fariazzExpert Protege
peterept said:
I've updated that original script so that it works whether you have a DK2 or not plugged in.
I've posted it to my blog:
http://talesfromtherift.com/unity-vr-editor-mouse-look-script/
The link seems to be broken.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 years ago
- 2 years ago