Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[RELEASED] VR Interaction Framework

Discussion in 'Assets and Asset Store' started by BeardedNinjaGames, Jan 28, 2020.

  1. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    Hey everyone,

    could use some help with this + the Rift S.

    I saw all of the positive reviews and comments, so wanted to give it a go.
    I followed the step of importing the Oculus SDK, then importing your VR Interaction Framework.

    However when I press play, it doesn't actually play on my Oculus.

    I have:
    - Rift S
    - Unity 2019.3.3f1

    I don't have this problem with other projects, so I'm sure it's something small.
     
  2. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    Hi Penhoat,

    I would try installing the Oculus Desktop package from Window -> Package Manager. You can install the XR Management package as well. I would not recommend using the Oculus XR Plugin at this time. I think that should get you going in the editor.
     
  3. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    You my sir, are amazing. Works like a charm. After testing it all out I'll be sure to leave a review.
     
    BeardedNinjaGames likes this.
  4. ZealousAppex

    ZealousAppex

    Joined:
    May 3, 2015
    Posts:
    16
    Great asset, thank you for the hard work!
    Is it possible when making a fist or pointing to be able to have the hands collied with objects that are grabble? Currently if you make a fist and put your hand into a grabbable object it picks it up. Normally it would only grab it when pressing the trigger. It would be nice to point and use the finger to roll a ball or shift an object.
     
  5. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    Thanks, Zealous! Yes, you can have hand collision enabled when pointing or making a fist. I believe that is the default, though v1.2 had a bug where sometimes the fist collision didn't activate. There is a component called "HandCollision" you can take a look at that handles enabling / disabling the hand colliders depending on if the grabber is pointing, making a fist, or holding an item. For example, it makes sure not to immediately enable the colliders when you let go of an object as that can make it fly off unexpectedly.

    You'll also want to change your Grabbable's Grab Button to "Trigger", as all of the prefabs use the "Grip" button instead (that's just what I'm used to).
     
    ZealousAppex likes this.
  6. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88


    Am I correct in my assumption that this doesn't work yet?

    Also, the lever goes in the opposite direction when trying to pull it:
     
    D3m0n likes this.
  7. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    Do you mean the zipline? That works - just grab onto it and hold trigger to move forward, or X to go backwards.

    The lever is an interesting issue : it only goes the opposite way in Edit mode - in both Android (Quest) and PC builds the lever should operate properly, but for whatever reason in Editor mode the physics joint doesn't quite behave right. I'm not sure what's causing the issue, but am looking into it.
     
  8. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    1,032
    @BeardedNinjaGames

    This looks great. I'm trying to create a hybrid FBIK system; have the player see their entire body but use animation for movement, crouching, jumping, etc., and then have the controllers for hands/arm positioning. I'm trying to create a seated VR experience.

    I've tried Final IK's VRIK, but it's a pain to correctly position the hand rotation.

    I've also tried Humanoid Control VR, every easy to setup, but way too expensive.

    Thanks.
     
  9. tucaz85710

    tucaz85710

    Joined:
    Jan 8, 2018
    Posts:
    14
    Hi! Is there a setting to slow the bullet down like a paintball gun?
     
    Last edited: Mar 7, 2020
  10. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    Yeah my mistake on the zipline.

    Good to know it's just in the editor and you're looking into it. You're doing great work!
     
  11. JasonWild

    JasonWild

    Joined:
    Jan 9, 2014
    Posts:
    14
    Is it possible to have a 2 handed gun that also has a magazine clip and a separate reloading slide like this gun in this video. If it is how would you do it? Thanks.

     
  12. liu_jiaye

    liu_jiaye

    Joined:
    Jan 31, 2020
    Posts:
    2
    Hi, could you do a tutorial on how to implement Final IK for the Full Body IK? Thank you.
     
    Abnormalia_ and atomicjoe like this.
  13. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    889
    +1
    I was planning on using Final IK with this framework too!
     
    Last edited: Mar 8, 2020
    Abnormalia_ and sjm-tech like this.
  14. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    @BeardedNinjaGames
    Quick question. How would I go about adding a script that enables running by pressing the left thumbstick?
     
  15. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    Hi Jason,

    Yes you can do a rifle like that. Next update (v1.3) expands on two-handed weapons a bit, and I will also have an example of a rifle included (see screenshot below). All you need to do to make it bolt-action is to set "AutoChamber" to false on the RaycastWeapon property. That way you have to load a bullet in for every shot. This is how the shotgun works as well, but uses individual shells instead of a clip.

     
    D3m0n, LaCorbiere, sjm-tech and 3 others like this.
  16. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    I'm in the process of creating a custom player controller that will have sprinting, but in the meantime you can modify the OVRPlayerController script. Around line 384 you can add :

    Code (CSharp):
    1. if (OVRInput.Get(OVRInput.Button.PrimaryThumbstick)) {
    2.     moveInfluence *= 5.0f;
    3. }
    Then you'll just need to make sure SmoothLocomotion is selected in BNGPlayerController, and that the PlayerTeleport script is disabled on the Player as well.
     
  17. JasonWild

    JasonWild

    Joined:
    Jan 9, 2014
    Posts:
    14
    That would be Great! When do you think 1.3 will be ready?
     
  18. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    The script you suggested for OVRPlayerController definitely works, however it seems that disabeling the Teleport script is not really possible.

    Simply disabeling it doesn't do anything, and even unselecting "allow teleport" will still have it functional.

    Btw love your snap points mate, they allow for so much creativity. Modular weapons being one of them!
     
  19. EstudioVR

    EstudioVR

    Joined:
    Jul 26, 2013
    Posts:
    123
    Hello. I have a situation where when triggering the hand trigger, the fist must close completely, as if to punch. But only with the trigger button activated, independent of any other. Any tips on what to trigger to make it happen?
     
  20. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    Check out DemoScript.cs that is on the player. It handles toggling teleport / smooth locomotion, as well as hand models. Most likely that is causing your teleport to be re-enabled. I would recommend disabling this component, and then using it as a reference to add your own features.

    I'm not quite sure what you mean. If you are looking to make sure the fist is closed when pulling the trigger, check out HandController.cs. It handles the animation / blend states. That should give you an idea of how to animate the hands based on certain criteria.
     
    EstudioVR likes this.
  21. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    1,032
    @BeardedNinjaGames

    Hi, any thoughts on my comment I posted above on this page? Thanks.
     
  22. joz_nascimento

    joz_nascimento

    Joined:
    Oct 24, 2017
    Posts:
    27
    Hi, I tried again your demo scene, but hand tracking dont work, even not checked "Disable Hand Tracking" option.
    By the way, in my project HandTracking works fine with your script.
    How to send an event click with hand pinch? I remember in the previous version, this was working with left pinch (and pointer on the right).
     
  23. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    Hi Adamz, I guess I'm not sure what your question is. I haven't tried VRIK personally, but I know some VRIF users have successfully integrated it into their own projects. I would think it would be relatively straightforward as you would just hook up the hand / hmd transforms. If FullBody IK is important to you then I that would probably be your best bet over the Unity IK. I've reached out to RootMotion to see if they would be interested in providing me with a copy of their asset so I can include a pre-configured prefab, or at the very least documentation about the process.

    In OVRManager (on OVRCameraRig) make sure "Hand Tracking Support" is set to "Controllers and Hands".
     
  24. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    @BeardedNinjaGames
    I have an issue where objects I create and add the scripts too for grab/snap, automatically reduce size when I take them out of a snapzone. Any idea what this might be?
     
  25. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    Make sure your object has a uniform scale (preferably 1,1,1). When you pull an object out of a SnapZone it scales based on it's initial local X scale.
     
  26. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    Awesome! Thanks for the help. I managed to use your snapzones to create weapon mods that can be attached on guns, but my silencer was receizing haha. Appreciate it.
     
  27. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    1,032
    I guess my question: is it possible to have full body movement that's controlled by the thumb stick using Blend Trees (Forward, Back, Left/Right Strafe, Jump, etc.), but use your IK system to control head rotation and arm movement only? Like having an avatar mask to only allow Blend Tree animation control the lower half of the body, and your IK for the arms and head.

    I'm trying to not have a player walk around his/her playing space in real life, just allowing someone to be seated to play the experience.

    Thanks.
     
    sjm-tech likes this.
  28. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    Hey @BeardedNinjaGames
    I seem to have an issue with snapzones and alignment of it's objects.
    I think I've literally changes every value (outside of the general transform), yet nothing solves my issue.

    How do I move where the object gets snapped? My objects are wrongly aligned (just got lucky with my barrel attachments I guess? snapzones01.png snapzones02.png
     
  29. AtomsInTheVoid

    AtomsInTheVoid

    Joined:
    Jul 27, 2015
    Posts:
    170
    I can't for the life of me figure out why I can't get the UI Canvas to work. It works just fine in the demo scene.

    If I take the Player and the UI Example objects and copy/paste them into a new scene, they don't work! What mysterious hidden setting am I missing that will make it all work? Everything is literally the exact same from the Demo Scene so it's blowing my mind why I can't get it to register a pointer and accept clicks.

    (click to make this bigger, then click the top left to view it in it's own window where it'll be the proper size)

    2020-03-10_16-32-57.jpg

    (Gif of me trying to click the canvas)
    https://imgur.com/P2KA910

    Any thoughts would be most appreciated, thanks!!
     
  30. Sholms

    Sholms

    Joined:
    Nov 15, 2014
    Posts:
    33
    Hello, is there any way to fix this? I don't want to drop the item
     
  31. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    In your new scene, do you have an EventSystem that contains the OVRInputModule? Take a look at the Demo Scene "EventSystem" GameObject. Make sure the "Standalone Input Module" is disabled as well, as that can interfere with input.

    The item is being dropped because it is going past the "BreakDistance" value set on the Grabbable. If the hand goes farther than this value from the object, then it will automatically be dropped. You can increase the BreakDistance value to prevent the object from being dropped, but it looks like the underlying issue is that the sword is flying off. You could try tweaking the mass of the sword, or seeing if Interpolation has any effect on the Rigidbody. I'll see if I can reproduce that on my end with the hammer.

    You can setup the body to have separate animations from the Hand / Head - Unity IK and FinalIK will both allow you to use Head / Hands separately from the body / legs animations. I have an example included that uses UnityIK for head rotation and hands, but I don't have any animations for the body yet, so no example for that. I've seen some members on the Discord channel using FinalIK and UnityIK, so you may be able to get some pointers there.

    The object is snapped to the SnapZone's local position and rotation (localEulerAngles) of Vector3.zero (0,0,0). So you may need to adjust your graphics and colliders to fit the center properly.
     
  32. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    I've used an unconventional method of using one of the demo scene spheres, and housing the attachments in the middle of that sphere. This works! cheers.

    Could I ask you what triggers the gun to be able to shoot once the mag attachment is inserted? Basically what I'd like is to simply trigger a different audiofile for shooting (silenced) when adding the attachment.
     
    Last edited: Mar 11, 2020
  33. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    You can change the "Gun Shot Sound" on the RaycastWeapon. In the SnapZone "OnSnapEvent" you can check for a RaycastWeapon Component, store the original gunshot sound, and then assign the new silenced sound. Then on the "OnDetachEvent" you can set the gun shot sound back to the original sound you stored. You'll probably want to extend the MuzzlePoint and MuzzleFlash position out a bit as well to so the bullet and FX come out at the correct position.
     
  34. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    Thank you for your fast response!
    So with this method I was able to turn on/off the laser on the laser attachment, and the light on my flashlight attachment with SetActive!

    However I'm struggling to understand the weapon sound piece. When I call on the PistolBase that has the RayCastWeapon script my options are these:

    snapzone.png
     

    Attached Files:

    Last edited: Mar 11, 2020
  35. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    Create your own function to pass into the OnSnapEvent. Make a class and add it to the weapon, with two functions like this :

    Code (CSharp):
    1.  public AudioClip SilencedAudioClip;
    2.         AudioClip originalAudioClip;
    3.  
    4.         public void OnBarrelAttach(Grabbable attachedTo) {
    5.             RaycastWeapon wep = attachedTo.GetComponent<RaycastWeapon>();
    6.  
    7.             // Store original audio clip so we can reset it later
    8.             originalAudioClip = wep.GunShotSound;
    9.  
    10.             wep.GunShotSound = SilencedAudioClip;
    11.         }
    12.  
    13.         public void OnBarrelDettach(Grabbable detachedFrom) {
    14.             RaycastWeapon wep = detachedFrom.GetComponent<RaycastWeapon>();\
    15.            
    16.             // Reset Audio
    17.             wep.GunShotSound = originalAudioClip;
    18.         }
    Then select these as your OnSnapEvent/ OnDetachEvents on the snap zones. Those two events pass in the Grabbable it was attached / detached from, so we can use those to get and set any public properties.
     
    Mark_01 likes this.
  36. AtomsInTheVoid

    AtomsInTheVoid

    Joined:
    Jul 27, 2015
    Posts:
    170
    D'oh! That was it, I knew I was missing something ridiculously obvious. Would be helpful to add a few lines of basic UI stuff for people in the documentation, even though it's not REALLY your system, it's nice to know which one to target.

    BTW! Another issue is I had a lot of standard Graphic Raycasters on my canvases, these need to all be changed to the OVR Raycaster instead or it won't work.

    I'm very happy this is working nicely! Now to figure out why my body ik object is offset on my rig compared to your demo rig... lol
     
  37. Abnormalia_

    Abnormalia_

    Joined:
    Jul 23, 2013
    Posts:
    61
    Editor (2019.3.4f1 and 13.0 Oculus integration) crashed few times after 2-3 hour sessions and checked logs. It was spammed with those:

    Code (CSharp):
    1. ovr_GetHandPose failed: ovr_GetHandPose: Only Oculus Link is supported.
    2. (C:\cygwin\data\sandcastle\boxes\trunk-hg-ovrsource-full\Software\OculusSDK\Integrations\OVRPlugin\Main\Src\Util\CompositorCAPI.cpp:78)[OVRPlugin][ERROR]
    Did you get same as well ?
     
  38. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    Are you getting this when using HandTracking (even just enabled) in the editor? Or is this in a build?
     
  39. Abnormalia_

    Abnormalia_

    Joined:
    Jul 23, 2013
    Posts:
    61
    No I'm not. Its not even Android build, just PC Oculus and VR Framework. I was just curious is it only me who gets those or other have same experience as well. I even could not find an option on PC build to turn hand tracking support.
     
  40. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    I appologise for the lack of understanding, scripting isn't my strongest quality.

    So this needs to be a new script, or added to the RayCastWeapon script?
    If it's a new script, do I add this to the attachment?
     
  41. ccoutinho

    ccoutinho

    Joined:
    Dec 24, 2016
    Posts:
    20
    Hi,
    Have been playing around with the demos in the VR Interaction Frameworks and they are really cool. Would it be possible to replace the shotgun model in the demo with my own model of a shotgun and have same functionality as the shot gun in the demo and if achievable how should I proceed. Thanks.
     
  42. lebo47

    lebo47

    Joined:
    Oct 18, 2013
    Posts:
    9
    When we added this to an existing Quest VR demo we are making, we see pretty massive performance degradation and fps drop. Is this known, and is there anything we can do to avoid this? Thank you
     
  43. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    Hey. Yes you can. I have replaced models with my own models and all functionality remains.

    What I did was create a new model to work around the existing functionality. With the shotgun this is a lot easier.

    But here is how I did it for the pistol for example (the folders with the little +'s in the hiearchy are my own):

    pistol01.PNG

    Both the Slider and GFX folder contain graphics for the gun, so I added my own custom made there to replace.
    Now you can got a lot further than what I did, but I wanted to retain the sights and seeing the bullet in the chamber.

    pistol02.PNG
     
    Last edited: Mar 13, 2020
    BeardedNinjaGames likes this.
  44. ccoutinho

    ccoutinho

    Joined:
    Dec 24, 2016
    Posts:
    20
    Thanks Penhoat. I will try this out.
     
  45. ccoutinho

    ccoutinho

    Joined:
    Dec 24, 2016
    Posts:
    20
    Hi,
    While playing the demo scene, there are 2 white Rings around the player, into which you can place your weapons, and carry along with you, which is very cool. How would it be possible to Add more Rings like this about the player and possibly make them a bit smaller. Also is it possible to add several clips into one Ring, which will enable the player to stash all his ammo into one Ammo Ring.
    Any help with this is most appreciated.
    Thanks,
    Chris
     
  46. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    Just search for the snap event prefab. I have added one on the front, like a front pocket. Which is quite a bit smaller, ans the thing is only visible once I grab an object and put it near it. (You can scale them to size)

    As for ammo, there's already a box for that labelled ammo between those two circles
     
    BeardedNinjaGames likes this.
  47. BeardedNinjaGames

    BeardedNinjaGames

    Joined:
    Jan 26, 2020
    Posts:
    125
    Correct - create a new script and then add it to the attachment. Then on the attachment's "OnAttachEvent" you will drag this component in, and select the OnBarrellAttach function (make sure it's the "Dynamic" version. Do the same for the OnDetachEvent. Now whenever you attach your object to the pistol, this function will get called.

    This uses UnityEvents, and in the next update v1.3 these will be used much more frequently to help respond to different events. You'll be able to do all sorts of things with this, so I'd recommend reading up on those a bit if you're unfamilar. They are basically there to make your life a little easier and not have to extend classes all of the time.

    Looks like Penhoat has got you covered (thanks!), but I just want to add that this next version makes modifying these weapons a litle bit easier as the models are using a single mesh instead of a bunch of cubes. But generally speaking, you'll want to swap out the graphics for the base model and for the slide (if it moves back on fire / eject, or is something like a shotgun). Then on the weapon you'll need to move the "MuzzlePoint" and "MuzzleFlash" objects to line up with your new model.

    That definitely shouldn't be happening. I've spent a lot of time making sure this is performance friendly and runs 72fps on the Quest :) You may have some errors happening, a quality setting to high, too many cameras in the scene, or something along those lines. Shoot me an email or message me on Discord and we can troubleshoot from there.
    Check out the "Inventory" GameObject on the Player. It contains the rings (there are shoulder slots as well). You can just duplicate those around the player. If you want to resize the ring, adjust the properties on the "Snap Zone Ring Helper" component. You can set the size for when not being used, and for when something is hovering within it.
     
    Abnormalia_ likes this.
  48. ccoutinho

    ccoutinho

    Joined:
    Dec 24, 2016
    Posts:
    20
    Thanks for showing me the way to use the Inventory Rings.
     
  49. ccoutinho

    ccoutinho

    Joined:
    Dec 24, 2016
    Posts:
    20
    Thanks. I believe you are referring to the AmmoDispenser object within the Inventory on the Player. Will try it out. Thanks.
     
  50. Penhoat

    Penhoat

    Joined:
    Mar 2, 2020
    Posts:
    88
    Thanks for the reply!
    I think I somehow have to call those scripts?

    I'm getting these compile errors:
    Capture.PNG
     
unityunity