Search Unity

Need help / Direction - New Dev

Discussion in 'AR/VR (XR) Discussion' started by denali5x, May 14, 2017.

  1. denali5x

    denali5x

    Joined:
    May 13, 2017
    Posts:
    27
    I am targeting Gear VR on the S8 specifically. Using Unity 5.6

    I'm a bit confused. I have made pretty good progress with OVR tools, however, I cant get any movement or interaction working.

    I've downloaded the free VR examples from Unity Asset Store, and they appear to use something completely different (VREyeRaycaster, etc) - I really like how the interaction works in the demos, and would like to potentially reproduce some of it within my own project, but when I import it, I get the OVR tools, and not the VRStandard Assets. How can I just download those?

    I've also made a few 3rd party purchases, which I have made pretty good progress in the direction I am going in, however, There are some issues I have encountered that cause roadblocks. One being the "gaze dot" is too close to the user, makes me cross eyes, and the camera renders what different than the OVR one.

    Basically, which of these packages should I really focus on. Ideally, I would love to recreate the UI functionality of the default Gear VR interface (oculus app?)

    I really prefer to use the 2017 Gear VR as a "laser pointer" to interact with objects, rather than the dot and gaze method.

    Thanks.
     
  2. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    My asset has these down in my signature, but if your looking on implementing your own, I'd be happy to talk about how to achieve what you wish (either laser pointer with the motion controller, or gaze pointer with the HMD).

    Gaze dot being too close generally has to do with raycasting depth. In general you have two different scenarios.

    1. Raycast hits nothing so you want to draw the reticle or laser to some depth instead of infinity. You usually pick an arbitrary length that makes sense for your game that is sufficiently far away.

    2. Raycast hits something. In general for this you want to draw the reticle or laser to a depth right in front of the object. You do this by querying the hitinfo and then draw right in front of that in the direction you racasted from.

    The Gear VR controller came out a few weeks ago so I'm adding stuff all the time (curved lasers for teleportation, etc.), but what you describe is already in the asset.
     
  3. denali5x

    denali5x

    Joined:
    May 13, 2017
    Posts:
    27
    Thanks for the response, appreciate it. Easy Input looks nice, It might be what I need. Before I invest more cash however, I'd like to know if it can help achieve my goal.

    To give you an idea what I am trying to do, I have created an Egyptian labyrinth. I want the viewer to look around and point the controller at certain objects, and "click/hold" on them, to launch information in popup window about said objects. This is more of an educational app than a game app. As the user moves through the labyrinth, there will be interactive objects they can investigate and learn about.

    Does Easy input help with player movement as well? I'm guessing this can be handled outside of the tool if need be?

    I'm all about learning these techniques in depth, but if this tool can help expedite my app from idea to production, I am all about it.

    Thanks
     
  4. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Currently the tool does have a laser pointer for the motion controller and one of the examples is a first person shooter type where you shoot in the direction of the controller. Also the pointer does allow selection of any Unity UI's clicking buttons, checkboxes, etc.

    Currently I do not have a laser pointer with grabbing implemented yet. I've been playing around with a few ideas before I settle on an implementation. This type mechanic appears in a decent amount of games and currently I'm leaning towards making one similar to what is in Zelda: breath of the wild with the magnetism tool. In that one when you grabbed the objects you could use the orientation to lift/lower the object and then you used the dpad to move the object left/right/forward back. This would work with the controller as well but unlike zelda where you had 3 joysticks so you could still move this fills up the entire gear vr controller. So within this I'm thinking of adding a double click to toggle between the grabbed object being moved and the player moving. It's not quite finalized in my head if you have some input certainly let me know. If I had to guess the ETA on it actually being implemented is about 2 weeks. Your needs is a little more straightforward sounds like a point/highlight/popup scenario.

    Easy Input does have some movement items in it currently (dpad movement and tilt movement). There are others I'm adding shortly as well like teleportation but it is not currently in there. From the sounds of your specific needs most would be additions so if your deadlines are within a few weeks it probably won't get you to your deadline quicker. If your timeline is further out then it would likely be in place when you needed it and you could focus on other tasks while I added those controls. I'm working on these tools very actively at the moment. This one is new and a very similar daydream one and also a cross platform one is submitted and should be on the store in a few weeks. I've been getting a decent amount of requests from a number of people and plan on adding a lot of controls to all 3 products.

    You can certainly do all this outside any asset store package. Your example would be a raycast from the controller and querying which gameobject the object hit. Based on that probably declaring a method that you call when it's grabbed to popup your info panel.
     
  5. denali5x

    denali5x

    Joined:
    May 13, 2017
    Posts:
    27
    OK, I have had a bit of time to explore Easy Input. The FPS Example is exactly what I am looking for. Thanks.

    I do have 2 quick questions before I get in and start experimenting with it in my own environment.

    1. The laser Pointer: Can I control it's visual distance? Right now it goes off into the distance. I really like how the Oculus app functions in the Gear VR interface. There is like a 3 foot laser, then a dot about 10 feet out. If not, no biggie.

    2. Also, can I control the speed of the player movement / or apply a slight accel/slow down easily, or will I need to get into the script level?

    Thanks again
     
  6. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    The laser pointer has a draw distance in the inspector you can certainly shorten that distance. The gaze pointer has the dot appear on items but currently the laser pointer does not. I can certainly add this behavior to the inspector.

    The inspector for the dpad has a sensitivity in it. You can raise/lower this if you want it to go faster/slower.

    I'm always looking to add things as well, so if there is anything else you'd like to see let me know.
     
  7. denali5x

    denali5x

    Joined:
    May 13, 2017
    Posts:
    27
    Got it, Thanks. However, I cannot seem to find how to control the "spin" left/right. My scene is a room, and spinning is nuts at default speed.

    Also, I am having issue re-centering the controller. Normally, I would hold down the right button a few seconds and it will recenter. How can I pull this off? When I attempt this action as it is now, the controller/last points away, possibly to my back.
     
  8. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    For the spinning there is a button sensitivity on the first person turn and shoot component that controls the spinning speed. Simply lower that number to what feels good for your app.

    The recentering on gear vr controller is a native call that doesn't have to do with the product. That being said I can't say I've had issues with it. It is important to note that the recentering usually takes into account both the controller and the headset and at least when I've done it expects both to be facing in the same direction. So if your looking right with the controller facing left when you recenter it will do undefined things. If you keep experiencing an issue with this scene only let me know, I wasn't able to replicate just now.
     
  9. denali5x

    denali5x

    Joined:
    May 13, 2017
    Posts:
    27
    Thanks.

    As for the centering, I must have had something out of wack. I copied your example right over into my own scene, deleted what I had set up and it all works perfectly now.

    Over all I am really happy how this tool is allowing me to achieve my goal without having to edit any scripts thus far. I'm still experimenting on the draw distance, it still shoots way off, but maybe it has to do with the scale of my scene?

    Also, real quick, my next quest is interactivity, I'll be able to use the laser pointer to click on objects and interact with them, correct? like open info boxes, maybe launch a video orstuff like that? Just want to make sure.

    Thanks again.
     
  10. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    The draw distance is in world units which in Unity is usually 1 unit = 1 meter but if your imported model had a different scale it could be different. In the example 100 meters is pretty far but if you set it to less than 3 you should see the end. I believe the home one stopped at what seems like 1 meter (~3 feet). You should be able to tell the scale of your model when you import it and can set the draw distance accordingly.

    For interactivity the scripts currently support GUIs (clicking buttons, checkboxes, etc.) with no code. It will also hit and be stopped by any object in your scene that has a collider on it. I can certainly add a hook for additional things to do when it hits an object but that is going to be tough to be able to do with no coding required and isn't in the product currently.

    Perhaps you can talk about how you are currently accomplishing those things on other platforms (popping up info boxes, launching a video, etc.) If these are always preexisting coded functions I can certainly add an option to the inspector to add a list of functions to call when it hits something. I would think that would be as far as it could go though because the list of "things to do" could be endless (enabling objects, changing color, moving them, etc.).
     
  11. denali5x

    denali5x

    Joined:
    May 13, 2017
    Posts:
    27
    The general idea I am creating is an educational walk through of ancient Egypt. I have already produced a 20 minute video on the subject, (which is the first in a 10 episode series) and I want to use this VR functionality as an extension to the video, to help promote it. This is my first foray into Unity and VR. That being said, My idea is an Egyptian catacomb where the player can walk through at their own leisure, and interact with various items. Some items may provide information in a pop-up plane which they could read more about. Another idea is to launch a quick 30 sec video clip that helps describe what the viewer is looking at, and a third idea is to actually look at 3d objects, with the ability to spin/flip/zoom it around in front of you to see it at any angle.

    That probably sums up the functionality I am looking to implement, and I think it should be a good introduction into how all this works.
     
  12. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    -Pop up plane will probably involve enabling/disabling a canvas UI
    -Playing the video will probably involve a call to Unity's video option or one of the alternatives on the store
    -the third will involve modifying the gameobjects transform

    In general, other than simple cases of enabling/disabling or moving, there is an infinite series of combinations of what you might want to do with the object hit with the laser pointer. It also usually evolves, in early phases of a game you might be content with the popup appearing suddenly out of thin air (just enabling it), and then later want to add animations, transitions, effects, etc. to make it look nicer. The inspector can realistically only grow so large before it becomes unusable as these get added. I will probably add some of the common simple things, but some of the more advanced are going to have to be done in code. In general, Adding to the inspector a function to call on the object is probably the most flexible. That way you can just select the function in the inspector that does your movie playing, or transitions and it will fire off that event when it's hit with the laser.

    Does this sound ok?
     
  13. denali5x

    denali5x

    Joined:
    May 13, 2017
    Posts:
    27
    I have an issue... I think.

    When I enter the VR world, the capsule, camera and cube are at 0,0,0. All works great.

    If I use the "trigger/pad" to turn left or right, and then try to go forward from there, I end up going into an unexpected direction, instead of forward. from my new-facing direction. It seems like the movement controls shouldt "reset" if that makes sense. Is there a way to reset this, kinda like.... once you stop spinning, reset the controls so the new facing direction takes me forward?
     
  14. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    This is in the example? Or in a scene you created?

    In the example forward will always be the direction the body is facing (which is dictated by the long presses). So up on the dpad will go in the direction of the capsule is facing. The camera represents the head so it's certainly possible that up on the dpad doesn't go the direction you're looking but if not looking off to the side (or if by chance you're using a swivel chair if you haven't spun the chair) then you're original facing direction will be the forward for the body. In the example, this is why the dpad control is set to control local position and not position (also known as world position) so that the movement is always relative to the body.

    The current dpad is good for if you're in a stationary chair. Based on feedback from another user I'm also currently making a look dpad (if you've played eclipse: edge of light it's similar to that) where up on the dpad will always go the direction you're head is facing (not the body). This type of game would be useful if you're using a swivel chair.

    Certainly let me know more on what you're seeing.
     
  15. denali5x

    denali5x

    Joined:
    May 13, 2017
    Posts:
    27
    OK I have most things worked out... I think, but one thing eludes me. I can't for the life of me figure out how to NOT walk through walls.

    I have tried the suggestions that a google search gives me, but nothing works. Do I need to add a script to the capsule to prevent this?

    Right now, my 3d imported model is "mesh collider", convex is checked, inflate mesh is checked, Ive even added a rigidbody to it. On top of that, I added a plane, and rotated it to mimic a wall... I go through everything.
     
  16. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    There isn't anything special that needs to be done just the normal things in Unity to make things collide, a couple of people have already done walkthoughs with various colliders. In general, your character should have a collider (usually a capsule collider is best so it can walk up stairs, etc.) and it should also have a rigidbody (usually you then freeze rotation on x, y, and z because you don't want the player tipping over but you do want it to collide with things). Lastly, you have colliders on objects in your scene you want it to hit (usually box colliders for performance but any collider will do).

    One thing that is important to note on rigidbodies and sometimes default mesh colliders is are when objects are extremely thin. Basically what you don't want is the player to be able to go fast enough to go through the object in one frame (because in that case to the physics system they never hit). Usually you want colliders to have some thickness to them to avoid this and also to avoid the object getting too close to the near clipping plane of the camera. If you absolutley must have really thin colliders with a fast moving character you can flip the collision detection from discrete to continuous, or you can make fixed update simulate more often but this also hurts performance a bit.

    If you've tried all this and are still having issues if you could send me your scene (you can zip it up and send it to the support email address) and I can take a look.
     
    Last edited: May 20, 2017
  17. denali5x

    denali5x

    Joined:
    May 13, 2017
    Posts:
    27
    Thanks, Ive sent a file. One thing I didn't have was a rigid body on the capsule, but its still a no go. =/
     
  18. denali5x

    denali5x

    Joined:
    May 13, 2017
    Posts:
    27
    Woo.. I got it.
     
    greggtwep16 likes this.