Forum Discussion
kumarrajaburela
12 years agoHonored Guest
For mouse events
Hai all,
I am recently started working for Oculus VR with unity3d. An d i implemented in my first person related games also. Controlls are working good but i struggled with blur quality and texture flickering and head bobbing. An d more over my big issue is mouse event functions. Normal mouse event functions are not working with unity. Is this statement correct or not?
Please help me.
Thanx in advance.
I am recently started working for Oculus VR with unity3d. An d i implemented in my first person related games also. Controlls are working good but i struggled with blur quality and texture flickering and head bobbing. An d more over my big issue is mouse event functions. Normal mouse event functions are not working with unity. Is this statement correct or not?
Please help me.
Thanx in advance.
7 Replies
Replies have been turned off for this discussion
- drashHeroic ExplorerYou might have to be a little more specific with your question, but yes mouse input works just fine in Unity as far as I can tell. :)
- vrdavebOculus StaffWith the Oculus plugin, you can still write code that responds to mouse movement (Input.mousePosition/Input.GetAxis(..)) or button up/down changes (Input.GetMouseButtonDown/Up(..)).
Raycasting from the mouse is more complicated, but I wouldn't recommend doing it anyway. First, you would have to convert the mouse position to a ray in world space. That is non-trivial because each eye image is distorted by a lens correction effect and the mouse can only be over one eye image at a time. So Unity's Camera.ScreenPointToRay(..) function wouldn't be enough. You might be able to build a look-up table to convert distorted screen points into world points...
It usually works much better to just raycast along the user's "gaze" direction. The ray origin is the "center" eye, or the average of the left and right camera positions and the direction is parallel to both of their forward vectors. Does this work for your use case? - kumarrajaburelaHonored GuestThanx for giving replies Mr. vrdaveb and Mr.drash,
But my already made for PC now i implemented for OCULUS VR technology in side that project, every thing is working fine accept mouse events because of in that project i used only raycast hit , by this cause mouse events are not working in oculusvr. What can i do . Please help me guyz. - vrdavebOculus StaffI haven't tried this, since gaze direction works so well. But one thing you could do is set up a dummy camera that covers the union of the two undistorted eyes. Put it halfway between the two eyes with the same vertical field-of-view as either eye camera. Then you can keep calling "Camera.ScreenPointToRay(Input.mousePosition);" with your dummy camera instead of Camera.main, etc. Make sure Camera.depth is lower than the OVR cameras' and its culling mask and clear flags are turned off to save performance. You'll need to draw your own 3D mouse cursor. You could use a sprite that always faces opposite the viewing direction. Its position would be dummyCamera.ScreenToWorldPoint(Input.mousePosition + mouseDepth * Vector3.forward). To cover the whole visible area, make the dummy camera's horizontal field of view wide enough that its FOV covers the union of the left and right eyes at mouseDepth: 2 * atan( tan(0.5 * eyeFovX) + 0.5 * IPD / mouseDepth ). Let me know if that works for you.
- ganeshdmHonored GuestThanx for giving replies with good suggetions , any way i found solution for that , even used raycasting also. Now mouse events are woking properly with raycast function. I feel very happy. And more over i have only one issue like quality (textures and unity text) .My textures and text are not clearly visible. What can i do for that. Please give a solution for me.
- ganeshdmHonored Guestkumar got solution for mouse events
- vrdavebOculus Staff
"ganeshdm" wrote:
My textures and text are not clearly visible. What can i do for that. Please give a solution for me.
This was covered in another thread: https://developer.oculusvr.com/forums/viewtopic.php?f=37&t=8950&p=119124#p119124
If you are having trouble enabling the camera texture, I would suggest anti-aliasing. If you use forward rendering, I'd recommend multisampling. If you use deferred rendering, the options are more limited. You could use the Unity Pro Image Effect "Antialiasing as Post-Effect".
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
- 6 months ago
- 7 months ago
- 2 months ago