I'm putting this mini tutorial here because I keep forgetting each step to get stuff interactive in Unity3d with Google VR sdk
Install the Google VR Unity sdk ( https://github.com/googlevr/gvr-unity-sdk )
Assets - Import Package - Custom Package
locate the google sdk where you downloaded it,
select all and import.
Next delete the main camera from the scene.
Add the GoogleVR-prefabs/GVRMain.
Add GoogleVR-prefabs/UI/GvrReticle to the GvrMain/Head object.
Add a floor object. 20x1x20, give it a texture so you can see it better when moving.
Move the GvrMain up about 1.8 m
You can now look around and have a reticle.
Now we want to be able to interact with objects and have the reticle have a sortof 'mouseOver'-effect.
To get this to work we need to:
Add a Physics Raycaster component to GvrMain/Head/Main Camera.
Add ui/EventSystem to our scene.
Add GazeInputModule to the EventSystem in our hierarchy. Make sure to move this up so that its above the StandaloneInput module.
Now we add a cube to the scene, and add an Event Trigger component to it. (This is important, because without the eventTrigger (even if you dont have an event added) the GvrReticle will NOT ot respond when you look at the object)
Thats the minimum you need to get object interactivity.
You can now add a ointer click event for example and do some useful stuff there.
Next step, how to get the coordinates of the location you clicked on.
No comments:
Post a Comment