Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Easy Input for Gear VR and Oculus Go [Released]

Discussion in 'Assets and Asset Store' started by greggtwep16, May 2, 2017.

  1. JohnnyJarrell

    JohnnyJarrell

    Joined:
    Jul 11, 2017
    Posts:
    3
    On the first person example, how would you go about changing when you press left/right on the pad to make the object turn instead of sliding left/right?
     
  2. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    In the inspector for the standard dpad component change it to use "local rotation" instead of "local position".
     
  3. JohnnyJarrell

    JohnnyJarrell

    Joined:
    Jul 11, 2017
    Posts:
    3
    When I change it to local rotation the player rotates when I press forward and back too instead of moving forward or backward like when the setting was local position. I was trying to make it so that when you press forward or back on the controller the player would move forward or back and when you press left or right the player would turn left or right. Thanks for your help.
     
  4. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Ah, I must have missed that. You can accomplish this by adding a second dpad to your gameobject one with local rotation and one with local position.

    The one with local rotation you'd set axis horizontal to y axis and axis vertical to none.

    The one with local position you'd set axis horizontal to none and axis vertical to z axis.
     
    billhung likes this.
  5. JohnnyJarrell

    JohnnyJarrell

    Joined:
    Jul 11, 2017
    Posts:
    3

    Thanks. Works great now.
     
    greggtwep16 likes this.
  6. mallmagician

    mallmagician

    Joined:
    Jul 15, 2015
    Posts:
    6
    Hi there,

    I'm after an out of the box d pad using the click and position on the touchpad. Up down left right. Does your asset include something like this?

    Thanks
     
  7. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Yes the dpad (there are actually two different dpads included) works out of the box. The standard dpad follows the direction your character is facing like traditional games, and the look dpad follows the direction the HMD is facing like some mobile VR games that are on the market. You can also specify a deadzone and whether or not you want it to happen on just touch of the pad, or if you want it to happen on touch and click.
     
    Last edited: Jul 17, 2017
  8. mallmagician

    mallmagician

    Joined:
    Jul 15, 2015
    Posts:
    6
    Perfect! Thanks. :)
     
  9. markv4

    markv4

    Joined:
    Jul 18, 2017
    Posts:
    2
    hi. just a question. on the gear VR controller I press the home button in order to allign the laser in the right direction. this works fine. but pressing the home button again and longer takes me into oculus home. is there some way to prevent this. I will give the controller and the gear VR to some customers and I never want them to leave the app!!!!!!

    another question. is there some way to test an app in the editor. now there is no way to test the app but just build it (takes some minutes) and test in in the gear VR. but I want to test an app and the interaction with the laser just on my PC.

    please do you have some solutions?
     
  10. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    You can test in editor via the keyboard mouse emulation that can be found in the documentation. Ctrl mouse drag reorients the motion controller and alt mouse drag reorients the head. The rest of the emulation can be found in the documentation for the buttons and everything else.

    As far as the home button goes, Oculus has reserved it's presses and there isn't a way to intercept it. Unity itself does not get the input. Now home button should suspend the app and Unity does have hooks for that OnApplicationPause(). You could try putting some native intercept there to prevent the app from exiting but I doubt this will work. Even if it did work it certainly won't pass review if you ever want to publish on the Gear VR store.
     
  11. davemart30

    davemart30

    Joined:
    Jul 23, 2017
    Posts:
    2
    Hi,

    Really grateful for the functionality you've built with this product. I have managed to setup a new scene with a grab object and pointer but it's really hard to pick the object up and move it around.

    It seems my problem is that gravity is keeping the object down. Is it possible to have gravity turn off when a grab object is selected and turn back on when released? A couple of snippet of code and where to place it would be good enough for me, if you don't think it should be a default or optional behaviour.

    The other thing that I'd like to be able to do is rotate the object while holding it. I was hoping that by default when a grab object is selected, rotation of the controller would rotate the object. Are you able to add this in, along with a set of lock options similar to the move capability it currently has.

    Cheers.
     
  12. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    I've a much better grab pointer in beta currently. Send our support email address your invoice number and I'll send it to you shortly. It's got more options and even 3rd axis control.

    It doesn't yet have rotation abilities but that's something I could add over the next few days and I can send you the beta copies as we go along.
     
  13. Tjeerd_SHL

    Tjeerd_SHL

    Joined:
    Jun 29, 2017
    Posts:
    9
    I'm curently also workign with the grab function and it works well ( if you dont move the controller to fast) But it would be totaly cool if it stics to the controller. So when i rotate the controller with my wrist ( screwdriver) that it will do the same thing. Now it only goes up and down. and it is hard to get it back or foreward.

    I have to say I ve now played with this asset some more but i realy like it. its so easy to move around in only a few steps.
    also the button pard and the togle part helped me out a lot :)
     
  14. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    I have the better grab with twist in beta currently that I built for @davemart30 . Send my support email address from the asset store page your invoice # and I'll send it to you as well right away. It should allow you to do the motions for a screwdriver that you need.
     
  15. Tjeerd_SHL

    Tjeerd_SHL

    Joined:
    Jun 29, 2017
    Posts:
    9
    HI I wrote you a message.
    But i have a new question. I have 120 bolt that have to move when I go over it with the pointer.
    So they are all in a row and are seperate objects. When the pointer hits the first bolt it will go up with only .5 meter. When my pointer is advancing to the next bolt the first bolt will go back in place and when it hits the second one it will go up. and so on and so on.. I could write 120 scripts but i think there should an easier way to do this? They are collision obects and when I did an "on mouse over" script with a print return it gave me the name of the selected objects. But I really dont know how to wirte the code that only the object that the mouse is on can translate up with a clamped hight.
    can you give me some hints in the right direction?
     
  16. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    I'm a little unclear of the usecase. Are you trying to make all the bolts go up at the same time, or individually? Also, mouse over isn't part of my product, but the grab receiver has similar events for onHover, onHoverStart, etc.

    Clamping a particular direction's height certainly doesn't require 120 scripts but probably doesn't belong in the grab script itself because the constraints could be on on arbitrary axis. Yours is pretty straightforward for height on the y axis but I could see min/max clamps for any axis or degrees all of which wouldn't be trivial and would clutter the inspector.

    In general it should only take 1 script with something like this (not tested or compiled). You would then attach it to your bolts. It's in LateUpdate so that it happens after all the other logic from movement. grabbing, etc. You could also do it earlier if you set the script execution order to occur after the others.

    Code (CSharp):
    1. void LateUpdate()
    2. {
    3.     Vector3 temp = this.transform.position;
    4.  
    5.     if (temp.y > maxClamp)
    6.     {
    7.         temp.y = maxClamp;
    8.     }
    9.  
    10.     this.transform.position = temp;
    11. }
     
  17. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Also, if you wrote me an email just today, I didn't get it could you send it again? I've responded to all of my current support requests and checked my spam folder as well, and didn't see a new one.
     
  18. Tjeerd_SHL

    Tjeerd_SHL

    Joined:
    Jun 29, 2017
    Posts:
    9
    Well it was not an email but a conversation here on the forum. If you scroll up and you see your login name next to that it says inbox. There you should have the message?
    What I ment with the bolts is that they should operate individually.

    I've now made a script but that is based on a mouseDown and up.
    Code (CSharp):
    1. public class BoltsUp : MonoBehaviour {
    2.  
    3.     void OnMouseDown()
    4.     {
    5.         transform.Translate(0, 0.5f, 0, Space.World);
    6.     }
    7.     void OnMouseUp()
    8.     {
    9.         transform.Translate(0, -0.5f, 0, Space.World);
    10.     }
    11. }
    Ofcourse this does not work with the GearVR lazer pointer. But I tried to figure out your script and I was looking for the Button.primaryIndexTrigger. This is the assigned button for the trigger on your controller but i couldnt find it in your script.
    I was looking at the FirstPersonTurnAndShoot script but there are some things I dont understand in the script. I putted some parts in teh code below
    Code (CSharp):
    1.  
    2. namespace EasyInputVR.Misc  //what is this?
    3. {
    4.  
    5.     [AddComponentMenu("EasyInputGearVR/Miscellaneous/FirstPersonTurnAndShoot")] //what is this?
    6.      void OnEnable()
    7.        
    8. //skipping part
    9.  {
    10.             EasyInputHelper.On_LongClick += localOnLongClick;
    11.             EasyInputHelper.On_QuickClickEnd += localOnQuickEnd;
    12.             EasyInputHelper.On_DoubleClickEnd += localOnDoubleEnd; //and finaly what is all this?
    13.         }
    I hope you can explain so I could figure out how to use the Gear Vr trigger when the Lazer pointer is aimed at the bolt.

    Thanks for all the help so far
     
    Last edited: Aug 15, 2017
  19. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    I respond to those as well, but just went through my inbox and I don't have a message from you (and I've received/sent messages with other people lately). Sent messages should appear in your inbox as well, can you resend it?

    The product uses it's own API so you won't find mention of Button.PrimaryIndexTrigger.

    Your question answers are as follows with the code.

    1. Namespaces are a feature of .NET and most languages. https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/namespaces/

    2. Add component menu is Unity's way to add your entry to the component menu. https://docs.unity3d.com/ScriptReference/AddComponentMenu.html

    3. The code in OnEnable is what subscribes to the events thrown by my API. These are examples of .NET delegates and events https://msdn.microsoft.com/en-us/library/17sde2xt(v=vs.85).aspx . Essentially you can think of them in the same way Unity uses Update(), OnEnable(), FixedUpdate(), etc. If you want something to happen every frame in Unity you put the code in Update(). Just like that, if you want something to happen when a button is first pressed subscribe to On_ClickStart and then put your code in that method. All the precoded controls have many examples of this and the documentation has the complete list of events in my API.

    Obviously, all of the above is if you are going down the coding path and if so I would read up on those basic concepts. However, if you just want to use the product without coding just attach the respective precoded component (like the dpads, laser pointer, gaze pointer, teleport reciever, etc.) That way you don't have to write any code.

    Also, in the latest beta which isn't out yet there is a hoverclickreciever with a precoded control that could do what you want. Send my support email address your invoice number if you want to receive this early.
     
  20. Tjeerd_SHL

    Tjeerd_SHL

    Joined:
    Jun 29, 2017
    Posts:
    9
    Thanks for the anwsers.
    I'll start reading the links you send me. Some how i didnt recieve your message either? Could you please send a message to my email so i could reply to your normal email.

    Thanks
     
    Last edited: Aug 16, 2017
  21. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Email sent. You might want to remove your email address from your previous post so crawling bots don't send you spam.
     
  22. rehan1994

    rehan1994

    Joined:
    Jan 20, 2016
    Posts:
    3
    I am facing some problems using your asset. Actually I am new in development of gear vr. I purchased your asset and whenever I makes build of your example scenes, its actually not working. In unity editor it shows gear vr controller with a line renderer but in S6 its not working with the controller nor with the headset. I am facing this problem in every example scenes. Can you please tell me the appropriate unity version, api level of android sdk and mobile android version. Thanks in advance
     
  23. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    What are you seeing? Does it build and just not respond to movement, or is it failing to build or start the app?

    In general most users are currently using either 5.6 or 2017.1.

    The setup for any gear vr build is as follows and I built an editor window into the products to remind you of the requirements.

    1. BuildTarget should be andriod
    2. Oculus placed in the Virtual Reality SDKs with virtual reality supported checked
    3. Oculus Utitilites unitypackage imported into your project
    4. MinAndroidSDK version should be 24 or higher
    5. Osig file for your device must be provided

    Certainly let me know what behavior you are seeing and what unity version and oculus utilities version you are using.
     
  24. rehan1994

    rehan1994

    Joined:
    Jan 20, 2016
    Posts:
    3
    Thank you so much for replying me.

    Actually it just not responding to movements. No pointers are working.
    I am using unity 5.5.0 but now i will try to update my version. Thanks
     
  25. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Ah ok that explains it. The gear vr controller came out during Unity 5.5.2 patch release. They did backport to previous versions but just as an minor version release. For 5.3 that was 5.3.8, 5.4 was 5.4.5, 5.5 was 5.5.2 patch release 3 (and I believe eventually 5.5.4).

    5.5.0 doesn't have a late enough oculus sdk to support the controller. Below is the article oculus release when it first came out. If you want to stay 5.5 I would get 5.5.2 patch release 3 (maybe 5.5.4), otherwise using 5.6.0 or later will work as well.

    https://developer.oculus.com/blog/developing-for-the-gear-vr-controller/
     
  26. rehan1994

    rehan1994

    Joined:
    Jan 20, 2016
    Posts:
    3
    I have updated my version to 5.6.3. Now i am going to test master example. I hope now it works for me
     
  27. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Unity 5.6.3 does have the native sdk integration and will work just fine.
     
  28. haskins

    haskins

    Joined:
    Oct 11, 2013
    Posts:
    24
    Hi, quick question, I'm trying to handle a GearVR 'PadClick' event for an OnHover event.

    I've been using StandardPointerClickReceiver to register 'On Hover Click Start' with the Trigger, and that works great. Is there a similar approach for PadClick?

    Thank you!
     
  29. haskins

    haskins

    Joined:
    Oct 11, 2013
    Posts:
    24
  30. haskins

    haskins

    Joined:
    Oct 11, 2013
    Posts:
    24
    I think I've figured it out.. although maybe verify this approach is ok?

    - add another instance of StandardPointerClickReceiver
    - set Button Condition to Gear VR Touch Click Pressed

    It's cool to have multiple StandardPointerClickReceiver on a single object, right?
     
  31. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Yeah, if your looking for the start (or any of the other events) to happen with one button like the trigger, but then the end to happen with a different button, then having mulitple components with just the appropriate events filled in is just fine.

    If you wanted the click of the pad to do both actions you would only need one component set to the pad click and could get rid of the trigger one.
     
    Last edited: Sep 3, 2017
  32. KFOLKESON

    KFOLKESON

    Joined:
    Oct 24, 2016
    Posts:
    1
    Hi. What do I need to do to be able to teleport up ontop of things with the curved pointer?
    And is there anything like the "teleport locations". (like in the Lab in the mountains, you know what i mean right ? :) )
     
  33. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    If you want to limit your teleportation to small areas, instead of putting the teleport receiver on the entire floor like the demo, you would put smaller objects (circles, squares, whatever) and attach the teleport receivers to only those.

    That way you limit the places you can teleport like in the lab.
     
    Last edited: Sep 6, 2017
  34. Hachemi_Hadjallah

    Hachemi_Hadjallah

    Joined:
    Aug 30, 2017
    Posts:
    2
    cool i like it .. im just a beginner on unity so i want to know if this can help me to make just grabbing and throwing an object with gear vr controller !! and how !! pls help me
     
  35. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    The latest beta just recently added throwing. Send our support email on the asset store page you invoice from the purchase and I'll add you to the list of beta testers.

    Otherwise throwing should hit the store once testing is complete in a few weeks.
     
  36. Titos

    Titos

    Joined:
    Jul 26, 2012
    Posts:
    12
    Does this work in a cardboard environment? (ie. without the oculus sdk)

    I have a GearVR controller, but am developing a demo in Cardboard and would like to use it.
     
  37. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    No both the mobile vr controllers (Gear VR controller and daydream controller) have used non standard pairing and only interface through their SDK to lock it into their respective ecosystems. I hope that they change their tune on that someday not only for cardboard, but for other platforms like PC as well. I can't say I think that's likely to happen though.

    There are a few hacker projects on the web for the daydream controller and at some point one might happen for the gear vr controller as well, but they usually stay pretty low level and aren't easy to build on top of.
     
  38. Kennyggg

    Kennyggg

    Joined:
    Feb 8, 2017
    Posts:
    10
    Hi Dev,

    I bought your asset and tried to do a simple UI button and combo pointer the problem is I can't click the sphere doesn't interact with the UI. I can't pinpoint the problem. I already have the input module, combo pointer and helper set-up. Sorry I'm new at Unity.
     

    Attached Files:

    • bug.PNG
      bug.PNG
      File size:
      113.8 KB
      Views:
      552
  39. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Can you post a screenshot of the inspector of the combo pointer and the event system as well? I want to ensure you have the right settings checked on the pointer and the input module.

    Although the screenshot you privided is a sphere and sphere's aren't Unity UI objects (buttons, sliders, checkboxes, etc. are). If you're looking to interact with a physical object (i.e pick it up, do some action, etc.) then you should add a collider to the objects and then use the physics options on the pointer.
     
  40. Kennyggg

    Kennyggg

    Joined:
    Feb 8, 2017
    Posts:
    10
    Here you go dev
     

    Attached Files:

  41. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    You don't have UI raycast checked on the combo pointer. If you check it you should be able to interact with the UI.
     
  42. ahike

    ahike

    Joined:
    Jun 23, 2017
    Posts:
    1
    Hey Greg what would you suggest to use to trigger sounds with the controller? I am trying with the laser pointer to no avail.
     
  43. Kennyggg

    Kennyggg

    Joined:
    Feb 8, 2017
    Posts:
    10
    Thanks dev :D
     
    greggtwep16 likes this.
  44. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    What specific action do you want to do to play the sound? Press a Unity GUI button, Hover over a in game object, press a button on the controller, etc? The answer would depend on specifically what you want to do. Let me know and I'll steer you in the right direction.
     
  45. unity_D90EeE4xOIBjPQ

    unity_D90EeE4xOIBjPQ

    Joined:
    Oct 17, 2017
    Posts:
    6
    Hi Greg! I just bought your asset a couple days ago, and first of all thank you for you work, so far looks pretty cool. I have been playing the last two days with it, to get use to the scripts, etc. I am an Architect, so I am trying to create architectural virtual reality visualizations, and right now I am trying to work in a material changer for scene objetcs, and a Scene Manager (to change between scenes with buttons in the scene). I created a MaterialManager, using several tutorials in youtube, but it's not working, and I have tried almost everything. I am not sure how this works, but maybe you can help me, I can send you the project example, or maybe if you are thinking to incorporate new tools to your asset, the material manager and the scene manager could be a couple geat ones. Thank you again!
     
  46. unity_D90EeE4xOIBjPQ

    unity_D90EeE4xOIBjPQ

    Joined:
    Oct 17, 2017
    Posts:
    6
    My name is Alvaro, btw
     
  47. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Hi Alvaro,

    Let me know what action on the gear vr you want to use to change the material/scene and I can certainly let you know what the best component is to use. For the material you can generally just set the new material in the inspector on the event you're trying to use. For scenes, the master example changes scenes on button presses, but certainly let me know what you specifically are looking to doing in your app for changing scenes.
     
    unity_D90EeE4xOIBjPQ likes this.
  48. unity_D90EeE4xOIBjPQ

    unity_D90EeE4xOIBjPQ

    Joined:
    Oct 17, 2017
    Posts:
    6
    Hi Greg! The material changer tool, would be a wheel that appears when you point your gaze over a sprite (for example, a paintbrush over a wall) with a bunch of materials so you can select several ones in real time. I am looking forward this, because it's a really powerful tool for architecture visualizations, to be able to be in a room and change the materials of the objects (with several material options). The scene is a more simple idea, which consists in putting a button in your scene, for example in the window of a room, in order to click on it and go to a Night Scene. In this way, I would be able to show a client how the room will look in a scene night as well, for example. I am trying to work on that, honestly I have not even started with the scene tool yet, because I am really stock with the material tool. I follow these videotutorials (
    ) in order to get what I want (because it's exactly that), but I am not able to make it work with the scripts from your asset. Than you for your fast response, I can send you the simple project of one of the scenes of your asset, with my work with the material changer wheel so far, so you can check what I am talking about if you want, and maybe give me some advice.

    Thanks again, great work!
     
  49. unity_D90EeE4xOIBjPQ

    unity_D90EeE4xOIBjPQ

    Joined:
    Oct 17, 2017
    Posts:
    6
    Hey Greg! I already figured out about the scenes manager, using one of your scenes examples. But still working on achieving that material wheel manager...
     
  50. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Hi Alvaro,

    I took a look at Selzier's video and that gives me a better idea of what you are trying to achieve. This could be done in several ways but just looking at this video it looks to be composed of a few things.

    1. The paintbrush object which when the gaze hover's over open's up the rest of the menu. In the video this appears this all appears to be physical objects because they're casting shadows but it could be done either with physical objects or Unity GUI elements the concept is the same. Basically you want an openMenu method to be called when hovering over the paintbrush. For this in my product I'd use the StandardPointerReceiver and add this method to the onHoverEnter event in the inspector.

    2. Once the Menu is open he makes the 6 material menu visible (again looks to be physical objects because of the shadows but could be done either way). When you hover over one of the 6 materials it calls a method to change the material on the backdrop. Again I'd use a StandardPointerReciever on the 6 materials and just call a different method that changes the material when you hover of them.

    3. When you leave hovering the entire menu it collapses back down. This is likely done by a hover exit of a much larger invsible object (which covers the whole area). You'd still use a StandardPointerReciever on this and this time use onHoverExit to call a method to collapse back down when you leave the menu area.

    These are just my observations from watching the video, he could have done it slightly different but that's the general gist. He makes good products but most tend to be Cardboard specific so I don't think you can just copy into a gear vr project. Recreating this should be for the most part just those 3 steps. Certainly let me know if you have more specific questions but looks pretty straightforward to do with the Standard Pointer Receiver and either the gaze pointer or laser pointer depending on which you want in your project.