Forum Discussion
enzedda
11 years agoExplorer
Using the mouse buttons
Greetings to you all. My first post. I have my dk2 and i have free Unity. I have setup mydk2 and it is great. I have placed the Oculus Unity4 integration into a simple new Unity scene and all views...
weasel47
11 years agoHeroic Explorer
I suspect the OP is not using any custom code for mouse-clicking, but is simply using "OnMouseDown." Clicking on objects in VR is much more complicated than that, unfortunately. OnMouseDown assumes a single camera rendering to a 2D screen with a mouse cursor associated with it.
To the OP, if you're brand new to development, you might want to mess around with Unity for a bit longer without OVR before you jump into the deep end.
The other two responders are right that you will need to use Raycasting. If you want a visible cursor that's attached to the player's view but that moves independently, that needs to be implemented as well. The mouse cursor you know doesn't really exist within VR. For my own projects, I've been using a cross-hair that's attached directly to the center of the user's view, so the user moves their head to aim at things rather than the mouse. I have a script that does a RayCast from the middle of the user's view and if a button is being pressed (the left mouse button, for example), that script sends a message to whatever object the RayCast is hitting.
To the OP, if you're brand new to development, you might want to mess around with Unity for a bit longer without OVR before you jump into the deep end.
The other two responders are right that you will need to use Raycasting. If you want a visible cursor that's attached to the player's view but that moves independently, that needs to be implemented as well. The mouse cursor you know doesn't really exist within VR. For my own projects, I've been using a cross-hair that's attached directly to the center of the user's view, so the user moves their head to aim at things rather than the mouse. I have a script that does a RayCast from the middle of the user's view and if a button is being pressed (the left mouse button, for example), that script sends a message to whatever object the RayCast is hitting.
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
- 2 years ago