Forum Discussion
MikeMoBG
11 years agoHonored Guest
Easy VR input solution for Unity
I got frustrated with Unity's lack of a good VR input solution while working on our game... so I built a plugin called World Space Cursor to handle it easily! Based roughly on this preliminary work by Mr. Barbagallo and the source for the new UI that Unity released, this plugin creates a cursor that exists in world space instead of screen space.
This solves the problem of the focus issues from the standard cursor (which is drawn in screen space). A cool side effect is that you can change the orientation of your canvases pretty drastically and keep your cursor looking great no matter what. You can see what I mean by looking at the demo here.
It works with every selectable Unity UI element by default, and can be integrated into any project within minutes! Take a look at the Unity Forums thread for more info and let me know what you think!
There's also a World Space Crosshair plugin in the works, too, and you can sign up for dev updates here to know when its released (don't worry, it won't spam you!).
This solves the problem of the focus issues from the standard cursor (which is drawn in screen space). A cool side effect is that you can change the orientation of your canvases pretty drastically and keep your cursor looking great no matter what. You can see what I mean by looking at the demo here.
It works with every selectable Unity UI element by default, and can be integrated into any project within minutes! Take a look at the Unity Forums thread for more info and let me know what you think!
There's also a World Space Crosshair plugin in the works, too, and you can sign up for dev updates here to know when its released (don't worry, it won't spam you!).
8 Replies
Replies have been turned off for this discussion
- cyberealityGrand ChampionInteresting concept.
- MikeMoBGHonored GuestThanks! The price will be reduced soon once Unity reviews our recent submission. Got some feedback that $20 seemed like a lot. If anyone sees this and feels generous, buy it before the price goes down to $5 ;)
EDIT: Price has been reduced to $5 permanently! - enzeddaExplorer"World Space Cursor works, in part, by setting up 2D box colliders on all the selectable objects in the scene and testing for collision with the cursor object."
And this works OK with the Rift DK2 and the oculus runtime? (whatever version)
And with the Oculus cursor?
Or does it require lots of experimentation and new scripting?
EDIT: What I am really asking, is it "plug and play" for the Oculus Rift or just for Unity? - MikeMoBGHonored Guest
And this works OK with the Rift DK2 and the oculus runtime? (whatever version)
Definitely! We have a DK2 that I used to test it personally. I used the latest version of the runtime as of a couple weeks ago.And with the Oculus cursor?
Not sure exactly what you mean, but this will replace the system cursor in Unity. In full-screen apps it will work with the Unity UI like you would expect a cursor to by default (the only difference is that this one renders in world space).What I am really asking, is it "plug and play" for the Oculus Rift or just for Unity?
It's plug and play for Unity specifically. It's a Unity plugin, so it won't work outside of the engine. There is at least one person I saw who mentioned s/he was working on an equivalent for UE4, though. This is a plugin meant for devs to put into their Unity VR projects and have a working cursor using the mouse immediately. It can be modified to use the OVR tracking since the source is included, but there are a lot of free tutorials on that already (including one on this forum), so we felt it was better to focus on something that didn't exist yet (as far as we know). - enzeddaExplorerThanks for that.
It certainly is quite unique !
As you say, it's "plug and play" for Unity but it's worth for the Rift is limited.
The Oculus cursor takes over everything in Unity when using the DK1 or 2.
It's worth as a "cursor" is very limited and not user friendly at all
The scripting required to even try and eliminate this is horrendous and changes every update.
I had hoped for a simple solution so's to be able to use the Unity cursor normally within the Oculus rift and the latest runtime.
To be able to click on a scene object and use that to perform functions, (as you can in Unity)..Now that would sell, I'm sure.
Any chance?
Anyway, thanks again MikeMo, I'm learning scripting through the Unity program and find I'm using the Rift less and less.
I'll certainly look into your World Space Cursor. - MikeMoBGHonored Guest
The Oculus cursor takes over everything in Unity when using the DK1 or 2.
Not sure what you mean by this, I've never experienced it at all when developing our game with my DK2 and the latest runtime. The only cursor that shows up for me is the regular system cursor (which is drawn in screen space and so is very annoying in the rift).I had hoped for a simple solution so's to be able to use the Unity cursor normally within the Oculus rift and the latest runtime. To be able to click on a scene object and use that to perform functions, (as you can in Unity)
Did you check out our demo? I'm pretty sure World Space Cursor is exactly what you mean. You can click on any UI object in a game's scene and it will work like it normally does. Any custom actions could be easily created, too. Or did you mean a replacement cursor for Windows so that you can use Unity while wearing a rift? If so that would be absolutely horrendous to figure out. I think that's best left to programs like Virtual Desktop. - ColinBAdventurer
"MikeMoBG" wrote:
The Oculus cursor takes over everything in Unity when using the DK1 or 2.
Not sure what you mean by this, I've never experienced it at all when developing our game with my DK2 and the latest runtime. The only cursor that shows up for me is the regular system cursor (which is drawn in screen space and so is very annoying in the rift).I had hoped for a simple solution so's to be able to use the Unity cursor normally within the Oculus rift and the latest runtime. To be able to click on a scene object and use that to perform functions, (as you can in Unity)
Did you check out our demo? I'm pretty sure World Space Cursor is exactly what you mean. You can click on any UI object in a game's scene and it will work like it normally does. Any custom actions could be easily created, too. Or did you mean a replacement cursor for Windows so that you can use Unity while wearing a rift? If so that would be absolutely horrendous to figure out. I think that's best left to programs like Virtual Desktop.
hello mike.I think I know what the op is getting at.
For instance, a simple scene.
A plane.
A couple of cubes.
A directional light or what have you.
Now using Unity by itself it's an easy job to write a script or import a script that does this:
Clicking on Cube one will change the color of the light.
Clicking on Cube two will reset the light color.
Pretty simple stuff.
Ok. Now add the Oculus Unity integration pak (Camera etc etc) and Voila! All mouse clicks are ignored !
An "Oculus" cursor (c) is displayed which does nothing except get in the way.
The useful Unity cursor is no longer available to use.
Apart from colliding with the Cube game object or using the horrible Raycast system there is no way to interact with the Cube objects. Certainly not with the so called Oculus "cursor"
I agree with ennzedda that a software solution that would allow us to use the mouse cursor with the Rift in the same way we can with Unity would sell rather well.
Get to it!!
Your current project does not do this unfortunately :)
The Rift as was mentioned before "takes over". - MikeMoBGHonored Guest
hello mike.I think I know what the op is getting at.
Ahh I see now, thanks for clearing that up. You're right that World Space Cursor won't do this. However, we are working on a World Space Crosshair that could do this theoretically. It may not do this with the first release, but if we have enough support for it, we can update it to include this type of functionality since most of the input work is already taken care of from our work with the World Space Cursor.
Unfortunately it would have to use raycasting since there really isn't another solution that would work well. However, with the experiments we've done so far it looks like we can optimize it pretty well. There are a few options for the end user to set the update/raycast rate, too, which can help with performance if necessary.
We're slowly but steadily working on this stuff (busy with our own game and other projects as well), but hopefully there will be some more updates soon. I did just upload a newer demo for World Space Cursor to our servers that shows off the cursor speed adjustments that were already there but not showcased. It replaces the older demo so it's at the same link as above (here) if anyone's interested.
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
- 1 year ago
- 2 years ago
- 4 months ago