Search Unity

Unity VR Samples now available

Discussion in 'AR/VR (XR) Discussion' started by willgoldstone, Dec 9, 2015.

Thread Status:
Not open for further replies.
  1. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    794
    Hi everyone,

    VRSamplesLogo-800x400.jpg

    So this forum is full of super smart folks like you who likely know way more about VR than I do! but we also realised that there are a lot of people out there who haven't dabbled in VR yet, and may well want to get started. So we created a set of sample mini-games and a menu that we call VR Samples (does what it says!). The project also has some re-usable sample components and completely commented code throughout.

    We have begun by supporting Oculus DK2 and the consumer GearVR so if you have a Samsung S6 or Note5 you can jump on this right now and try it out. Download it from the asset store here -

    https://www.assetstore.unity3d.com/en/#!/content/51519

    We worked with our good friend Iestyn Lloyd (@yezzer ) on this project and he also put together a set of articles to help you get started on our Learn site here -

    http://unity3d.com/learn/tutorials/topics/virtual-reality

    We'd love to hear your feedback and many random requests for porting this to platforms we're yet to discover ;) so let us know what you think!

    Thanks all

    Will
     
  2. Aiena

    Aiena

    Joined:
    Nov 18, 2013
    Posts:
    1
    Thank you for that work !
    Honestly I think it can be as helpful to new VR developers than to VR "pro" developers (like me). Actually, I have been dealing the past months with just the same issues you resolve here (like the "hold to confirm interaction", or UI display suitable to VR, or optimization in text display). And my solutions were far less beautiful than yours :p
    Thank you for making it easy for anyone to jump into VR :)
     
    williamj likes this.
  3. SniperEvan

    SniperEvan

    Joined:
    Mar 3, 2013
    Posts:
    161
    The vr samples are really great.

    I noticed that it works fine if I play them in the editor but if I build to a windows standalone the file cannot be opened. Is that just me?
     
  4. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    Awesome work Unity Team, thank you! Is there a way to use this with non-GearVR phones like a Samsung S5, the Google Tango device, or other deivces? Possibly we can set VRDeviceType.None, VRDeviceType.Stereo, or VRDeviceType.Split, and in this case I would think the Oculus SDK is not needed so I could avoid the error:
    "[VRDevice] Initialization of device oculus failed."

    We develop VR and teach VR development and those without the GearVR phones readily available would not be able to jump in on these demos.

    Is there a way to use UnityEngine.VR without the Oculus SDK for non-Oculus Development? For example, we want to render VR but don't need any of the Oculus distortion corrections running.
     
    Worker73 and ZiadJ like this.
  5. Harald_Heide

    Harald_Heide

    Joined:
    Jul 22, 2015
    Posts:
    81
    Just when I was diving into controlling Gear VR with touchpad comes this along. Very Thorough and perfectly understandable even to a senile old cobol programmer. Would be great to also have an example of how to best utilize the touch pad on gear VR in a FPS game. Have got some swiping on parent of camera to function but not quite as nice as in the child adventure game Finding VR. Would love to se a script implementing Gear VR touchpad functionality similar to the way it's done in this title.
     
  6. DistortionFactor

    DistortionFactor

    Joined:
    Nov 23, 2015
    Posts:
    8
    I just found this thread after posting on the forums. I'm new to Unity and I'm thankful for the new VR examples.

    Can I develop without being physically connected to the hardware?
     
    hrdkjain and ZiadJ like this.
  7. brentjohnson

    brentjohnson

    Joined:
    Dec 10, 2015
    Posts:
    3
    Thank you so much guys, this is huge! I just have one small request. Do you think you could also do an additional scene with various UI elements that you select for the Gear VR? I think what I am trying to describe is a character selection screen that shows various animated models. Perhaps when you select a button a character will appear and and their animation will auto play, and walking sound will play. If you select another button, another character would be selected. If I could do this simple thing I think I could do anything! I have spent weeks and still can't make this happen :(

    PS. Another nice thing would be an intuitive FPS movement/interaction script via only the Gear VR touchpad like the poster above mentioned. Maybe also a fun project with an object interaction script that works similarly to that DK2 demo "I expect you to die" that was a pretty awesome object interaction idea without having motion controllers available.. and since Gear VR won't have input like that for a while it could be really useful.
     
    Last edited: Dec 10, 2015
  8. Gounemond

    Gounemond

    Joined:
    Nov 17, 2012
    Posts:
    6
    Thank you Unity team, great work!

    I am kind of glad that some systems I was using (like the crosshair solution, or the input from view) has been now been made directly from you (and in a more fashionable way). I'm going to update my systems to work from your new basis, and I will use your scripts as a starting point for good practices.

    Really loving you.
     
    stevenbrent and williamj like this.
  9. stevenbrent

    stevenbrent

    Joined:
    Nov 22, 2015
    Posts:
    25
    @willgoldstone -- thanks for your work on VR support and for the examples. So at this point, is there any reason to use the Oculus Utilities for GearVR development? The built-in support seems complete, but I am wondering if I miss out on anything by not using the Oculus code. Thanks!
     
    DistortionFactor likes this.
  10. brentjohnson

    brentjohnson

    Joined:
    Dec 10, 2015
    Posts:
    3
    @stevenbrent, it doesn't appear to have all the FPS movement stuff or various key mappings that the Oculus Utilities includes. So may still need it for the time being. I hope it does not conflict with the Utilities but I will find out tonight.

    I'm guessing something similar to Oculus Utilities will get fully integrated by default eventually? Hopefully one day it will be with multiple options for locomotion, like either standard fps movement, teleportation, full tank modes and "go where you look", comfort turning modes, etc. Basically many of the settings that are preferences for users in VR that many of us are not experts on and would have no idea how to program for.
     
    stevenbrent likes this.
  11. stevenbrent

    stevenbrent

    Joined:
    Nov 22, 2015
    Posts:
    25
    Thanks, @brentjohnson -- Seems like the prefabs provided with the Oculus Utilities (OVRPlayerController and OVRCameraRig) take a lot of the work out of setting up the player and the controller. I do see a bunch of comparable scripts (camera raycaster stuff etc) in the Unity samples - so maybe one can get on fine without the Oculus Utilities. And you can import the VR Samples project when you create a new project now. So for me, the learning curve will be in using / modifying the native scripts... Please let me know how you get on with using the Oculus Utilities in the latest Unity build. Thanks!

    UPDATE (a few hours later) - The scenes in VRSampleScenes > Scenes > Examples are great. Each one demonstrates the use of the scripts found under VRStandardAssets > Scripts in a really clear way, without any distractions. The only thing missing is a First Person character controller (eg for a bluteooth gamepad), but I think that can be pretty easily done by using a generic GameObject, mounting the MainCamera to it, and then attaching a simple script to listen for gamepad input. I will test this theory out tomorrow!

    UPDATE #2 (Friday night) - So the player controller setup works fine as described above. I just need to get my mind around the fact that head orientation does not equal player orientation. So I just need to think about whether I want the player rotation to change with head orientation or use the gamepad right stick for that.
     
    Last edited: Dec 11, 2015
  12. t_w

    t_w

    Joined:
    Aug 4, 2015
    Posts:
    55
    Cool!!!
     
    williamj likes this.
  13. brentjohnson

    brentjohnson

    Joined:
    Dec 10, 2015
    Posts:
    3
    It appears the new Unity 5.2.3p3 patch that fixes a long standing VR performance bug broke the project. Under the MainCamera all the scripts show "The associated script can not be loaded. Please fix any compile errors and assign a valid script."
     
  14. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    794
    @stevenbrent regarding oculus utilities it depends what you're doing I guess! If you still find need for them, use them! Regarding first person- we don't have a first person controller for VR in the samples for the reasons we list in the accompanying article regarding Vection.

    Did you get chance to read those yet?

    @everyone our CMS for the learning content is currently broken for gif playback so I wanted to apologise to those of you trying to follow them without clear examples the animated gifs provide we are hoping to get a fix shipped early next week.
     
  15. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    794
    @brentjohnson you appear to be discussing 5.2p3 which suggests you are opening this project in that? If so - don't - we shipped it in 5.3 deliberately so downgrading the project may mean a loss of references which I think is what you are describing? Sorry your message was a little confusing!
     
  16. stevenbrent

    stevenbrent

    Joined:
    Nov 22, 2015
    Posts:
    25
    Thanks, @Will Goldstone - I'll check out the info on Vection. (for anyone who's looking for that: http://unity3d.com/learn/tutorials/topics/virtual-reality/movement-vr?playlist=22946 ) Even just at my novice level of experience, I can see how there is a whole new art & science of player control to learn here, very different in some ways from even traditional 3D FPS controls. It seems like doing as much as possible with head movement and gaze detection is a good idea in general. I tried out Dreadhalls from the Oculus store last night, and was definitely feeling the negative effects of independent head / virtual body movement while my physical body was stuck in the chair!
     
  17. kavs

    kavs

    Joined:
    Jun 29, 2012
    Posts:
    25
    You just made me update from 5.2.3 to 5.3. :D

    Thanks for this! As someone just getting their feet wet, this appears to be a toolset that'll equip me to make whatever I want.

    Minor Unity question: Inside the editor, I 'checked for updates' and it said there was nothing, but on the website it shows 5.3. Is there a reason for the delay? Do you only put it in the client when you're sure it isn't lighting things on fire?
     
    DistortionFactor likes this.
  18. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    Quick tutorial on porting these demo to Google Cardboard:
     
  19. pixelvspixel

    pixelvspixel

    Joined:
    Jul 18, 2012
    Posts:
    11
    I've been having issues parenting the Camera rig in the examples to a basic first person controller. It seems like the reticle becomes offset or just does work at all once it's parented. My gut instinct is that the VREyeRaycaster is written for stationary camera, could be wrong as I'm not a programmer.
     
  20. gevarre

    gevarre

    Joined:
    Jan 19, 2009
    Posts:
    132
    Any chance of getting a version of this for SteamVR? I'm assuming it's getting pretty similar now with everything being based on openVR.
     
    wcoastsands and scottunity like this.
  21. gamegirl1984

    gamegirl1984

    Joined:
    Nov 6, 2014
    Posts:
    102
    This is really cool. But i'm having issues incorporating this with a FPS character controller. I am working on a FPS for Rift and would really like to use these scripts. also I need to tweak the Shooting target script to put onto a zombie and have animation trigger when the zombie gets hit and am having a hard time changing the script. I have never used Ray Casting. Anyone have a tweaked shooting target script for use on an enemy??
     
  22. SniperEvan

    SniperEvan

    Joined:
    Mar 3, 2013
    Posts:
    161
    I don't have a script to give you but I can give lots of suggestions. Maybe it would be better to start a new thread?
     
  23. castana1962

    castana1962

    Joined:
    Apr 10, 2013
    Posts:
    400
    Hi All,
    I am starting with VR into Unity and I have not any Oculus Rift Head yet but I have read in a book that I could do a VR project with Unity although I have not this one at the moment.
    According this book I should include non Rift player Controller( and be sure to include using the mouse to control where the character looks) and then by enabling and disabling the appropriate player controllers I could test and run with or without the Rift attached, for it, Could anybody teach me step by step this procedure?
    Thanks in advance
    castana1962
    Ps. sorry for my little english
     
  24. acme3D

    acme3D

    Joined:
    Feb 4, 2009
    Posts:
    203
    Downloaded VR Samples; tried to compile following instructions but I get no samples, I get GearVR's small control panel (the one that display battery level, allows to change brightness, etc.).
    Using a Note 4 with Android 4.4.4 on it. Compiled with Unity 5.3.1.
    "Virtual Reality supported" is checked, OVR signature file is there... what could be wrong or missing ?
    Even creating a very simple project with a camera and a few cubes around gives the same results...
     
  25. Lukas2233

    Lukas2233

    Joined:
    Feb 3, 2016
    Posts:
    1
    Does this work with Runtime 0.8 yet?
     
  26. stevenbrent

    stevenbrent

    Joined:
    Nov 22, 2015
    Posts:
    25
    (crossposted from the Virtual Reality forum)

    I'm playing with the VRSamples project in the latest Unity release, and am having trouble getting the included MainCamera Prefab to animate at runtime. What i've done is to create a simple transform animation (eg moving the camera on rails from starting point to end point) to run upon the scene loading. The animation is attached to the MainCamera and the animation runs fine in the Scene and Game views in the Editor. But when I build and run the scene on my GearVR, the animation doesn't run. I tested this out with a plain vanilla (non-VR) camera object and it works as expected, so I wonder if there is something in one of the scripts included with the VR MainCamera prefab that is interfering with the animation starting up. Any and all clues are appreciated.
     
  27. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    stevenbrent likes this.
  28. stevenbrent

    stevenbrent

    Joined:
    Nov 22, 2015
    Posts:
    25
    Good call! I created an empty game object as a parent for MainCamera, attached the animation to the parent object, and confirmed that this works in Scene and Game modes. An interesting quirk, and I appreciate your help.
     
    Selzier likes this.
  29. myp5564028zhy

    myp5564028zhy

    Joined:
    Feb 13, 2016
    Posts:
    1
    Ask, why I can only look up and down about the case, the location can not move? Is through the control of the position of the handle?
     
  30. Kim-Leigh-Pontin

    Kim-Leigh-Pontin

    Joined:
    Nov 2, 2015
    Posts:
    1
    Thanks so much for these assets. Sadly I'm unable to play from the MainMenu scene as it crashes every time. Does anyone else have this problem? I'm on a mac, using Unity 5.3.
     
  31. SummitJain

    SummitJain

    Joined:
    May 30, 2014
    Posts:
    12
    yes it does. work
     
  32. Ignacio-Liverotti

    Ignacio-Liverotti

    Unity Technologies

    Joined:
    Jul 23, 2015
    Posts:
    36
    Hello Kim-Leigh,

    Yes, this was a known issue in 5.3. It has been fixed in the patch releases, so please update to the latest one (see https://unity3d.com/unity/qa/patch-releases)

    Best,
     
    stevenbrent likes this.
  33. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    Play "The Maze" for Google Cardboard:
     
    wcoastsands and SimonDarksideJ like this.
  34. Justin-Wasilenko

    Justin-Wasilenko

    Joined:
    Mar 10, 2015
    Posts:
    104
    Anyone notice the reticle jump with the included reticle in these samples? In the demo scenes its quite small and hard to notice. But using the included Reticle script, with a larger image produces a large noticeable jump when the reticle moves from the default position to something it can collide with.

    This doesn't happen in the editor, but is quite pronounced when demoing in VR.

    In VR it looks like the reticle jumps between eyes
     
    Last edited: Mar 6, 2016
  35. jesusluvsyooh

    jesusluvsyooh

    Joined:
    Jan 10, 2012
    Posts:
    377
    Thanks for the samples, done a few Oculus rift things already, just got me Gear VR yesterday.
    I prefer the gear vr, less wires, which was my main problem with the oculus, restricted movement and turning.

    (Watched Avengers last night in HD in a 3D cinema, with my surround sound headphones on, all whilst sat alone in my dark room. Was glorious!!)

    Edit: Any chance any of this is aviable in js/javascript/unityscript ?
     
    Last edited: Mar 10, 2016
  36. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    Once 5.4 lands I would love to see this sample updated to handle both the Rift and the Vive.
     
  37. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    And OSVR :rolleyes:
     
    SimonDarksideJ likes this.
  38. jesusluvsyooh

    jesusluvsyooh

    Joined:
    Jan 10, 2012
    Posts:
    377
    And Google Cardboard :D Might as well have them all.
     
    SimonDarksideJ likes this.
  39. beachrunnerjoe

    beachrunnerjoe

    Joined:
    Apr 26, 2013
    Posts:
    11
    This is fantastic! Thanks so much creating this. Are we free to use any of these assets in our own commercial projects? I'd love to use the shooting range dome structure for something I'm working on. Thanks again.
     
  40. alanic

    alanic

    Guest

  41. thepbac

    thepbac

    Joined:
    Aug 14, 2014
    Posts:
    1
    Hello everyone.
    I am using VRSample and i have a question.
    In SelectionRadial class, when I call the method WaitForSelectionRadialToFill - nothing happened display. But when I call the method Show in this class, it works. So what the difference between them? What is the recommend method when I used this class?
    Thank you.
     
  42. Grimmick

    Grimmick

    Joined:
    May 23, 2016
    Posts:
    1
    Very nice stuff! I especially like the concept of Maze! So the player head could actually be used as third pointer together with Vive controllers ;D

    For anyone wanting to use this with a HTC Vive and SteamVR, I wrote down some instructions how to make it work (tested with Unitx 5.3.5f1 and SteamVR plugin 1.1.0):
    • Create a new 3D project with the assets "SteamVR Plugin" and "VR Samples"
    • Do this for every scene (Flyer, Intro, MainMenu, Maze, Shooter180, Shooter360):
      • In the hierarchy, find the "MainCamera"
      • In the inspector click on "Add Component" and select "Steam VR_Camera"
    • Maze:
      • If you test the scene after adding the "Steam VR_Camera", you will notice that you start next to the turret instead of the original camera position... To fix this, we need to give the MainCamera an additional parent transform. (disable play mode again if you tested)
      • Add a child GameObject to VROrbitCamera and rename it to "CameraContainer"
      • Type in the same values for X,Y,Z as for the MainCamera (0, 9.45, -16.23)
      • Drag&Drop the MainCamera onto CameraContainer to make it a child (make sure the transform of the MainCamera looks reset afterwards)
      • I also had to change the Albedo of Maze -> MazeCourse -> MazeWalls to be able to differentiate between walls and floors because there seem to be no shadows (also in the editor, seems to be unrelated to SteamVR. Does anybody know anything about this?)
    • Flyer:
      • If you test the scene after adding the "Steam VR_Camera", you will notice that the ship does not react to the movements (rotations) of your head (disable play mode again if you tested)
      • Open the FlyerMovementController.cs script in VRSampleScenes/Scripts/Flyer
      • Search for this line:

        Code (CSharp):
        1. Quaternion headRotation = InputTracking.GetLocalRotation (VRNode.Head);

        and replace it by a version which should be compatible with all VR systems:

        Code (CSharp):
        1. Quaternion headRotation = Quaternion.LookRotation(m_Camera.transform.forward);
    Done! Then you can also enjoy it with a Vive (well, pressing the Ctrl, Left and Right keys on the keyboard behind your back is not too enjoyable, but that's another topic ^_^)
     
  43. VRGirl310

    VRGirl310

    Joined:
    Jun 3, 2016
    Posts:
    4
    Great work, thanks for sharing!
     
  44. Voronoi

    Voronoi

    Joined:
    Jul 2, 2012
    Posts:
    587
    I had a question about a good way to add Oculus Remote input without making any changes to the VRStandard Assets. The reason is I like using VRInput.cs and a number of the Raycasting scripts in the examples use it. I can certainly add this code to VRInput.cs to CheckInput() get the behavior I want:

    Code (CSharp):
    1.             if (OVRInput.GetDown (OVRInput.Button.One)) {
    2.                 if (OnDown != null)
    3.                     OnDown ();
    4.             }
    But, I would rather not alter VRInput.cs in case I update the assets and also so I can just have my own script that I can use for other projects. I tried inheriting from VRInput.cs, but that requires me to make the original CheckInput() a virtual public method. And, it's not possible to inherit the OnDown Event at any rate.

    What is the correct way to do this? I suspect an Interface, but those always confuse me a bit.
     
  45. dannyoakley

    dannyoakley

    Joined:
    Jun 18, 2016
    Posts:
    11
    Grimmick,
    Thanks for the heads up (ha ha) on using with the Vive. I've been trying to figure out how to see these samples in action.
    Any clue on how to get the Vive controllers working with it? Any help or direction pointing would be appreciated.
     
  46. flavan

    flavan

    Joined:
    Jun 24, 2016
    Posts:
    1
    Hey!
    Is there anybody managed to make Vuforia work on HTC vive using Vive's camera in unity? I have been working on it for days.Not getting any results
     
  47. amanieux

    amanieux

    Joined:
    Jul 15, 2016
    Posts:
    5
  48. Vagus9816

    Vagus9816

    Joined:
    Jul 25, 2016
    Posts:
    7
    Also,do you use another forum?@flavan Can you introduce me? Sincerely.
     
  49. TheTwitt

    TheTwitt

    Joined:
    Apr 6, 2016
    Posts:
    5
    Good Work Unity 3D !!!!!!!!! It Seems Intresting...:)
     
  50. Vagus9816

    Vagus9816

    Joined:
    Jul 25, 2016
    Posts:
    7
    So,we can study together,i think,I should learn from you
     
Thread Status:
Not open for further replies.