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
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Need an easy fix for creating a moving player for oculus go (asset?)

Discussion in 'VR' started by JessTaylor90, Apr 24, 2019.

  1. JessTaylor90

    JessTaylor90

    Joined:
    Aug 22, 2017
    Posts:
    9
    Hi all,

    I've been trying to get the OVR player controller working for ages and am at the end of my tether. I haven't been able to find any tutorials that have helped; my next move, unless someone has a better solution, is to follow along a tutorial and try and make my player controller from scratch. As someone with little scripting experience, I'd rather avoid this if possible.

    I'm also looking at 'Easy Input for Gear VR and Oculus Go' on the asset store. Has anyone used this? All I want is a character that will be able to move around my scene using the oculus go remote - if you're used this, will it do the trick? Or does anyone have any other suggestions/assets/tutorials they can recommend?

    Again I have very little scripting experience, so tutorials that assume a lot of knowledge or assets that require a lot of fiddling with make me a bit wary.
     
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,914
    You just want basic teleporting? I've implemented it in a Go project, which you can see here.



    If that's what you're looking for, I can help you get that going.
     
    Sibu_Zangqa likes this.
  3. max-louw

    max-louw

    Joined:
    Apr 16, 2019
    Posts:
    2
    Hey Schneider21,

    This is exactly what im looking for but i am using the Oculus Rift. Is this compatible?

    Kind Regards,

    Max
     
  4. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,914
    The concept is the same, sure.

    I started with this repo and modified a few things to suit my needs. I jacked the distance way up to like 25m and removed the adjustable distance, as my Go controller seems super sketchy with the touchpad input. I also added a toggle for teleport mode to allow other interactive modes like when you're in a menu. And of course, made everything red.

    Let me know if you have questions!
     
  5. JessTaylor90

    JessTaylor90

    Joined:
    Aug 22, 2017
    Posts:
    9
    nope, literally I just want a player that will walk around, nothing fancy. I've used the OVR player prefab, build the game and while I can look around, I can't use the remote to walk. I'm new to unity so I have no idea what the problem is
     
  6. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,914
    I could have sworn I saw in your original post that you wanted teleport movement, but that's clearly not what you said... :confused:

    So you want something more like using the touchpad as a directional input for FPS-like movement? That's actually easier, really. Except I've had a hell of a time getting reliable X,Y values from the touchpad, which you'd want to be totally accurate if your movement system relies on it.

    OVRPlayer is a surprisingly complicated object for not having a lot of apparent uses out of the box. I think it contains more Rift functionality than it does Go. There isn't any movement system built-in with the Oculus integration as far as I could tell.
     
  7. JessTaylor90

    JessTaylor90

    Joined:
    Aug 22, 2017
    Posts:
    9
    exactly that! I can't get my character moving at all using the headset. i can walk around using the keyboard on my computer in editor, but if i build and put the app on my go, no movement at all
     
  8. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,914
    Easy peasy! I haven't tested this code, but it should get you well enough along the way.

    You'll need a script attached to your player controller object (OVRPlayer, if you're using that). If you want the touchpad to have a dead zone near the center, so the player can rest their thumb without moving, use a variable to keep track of what that value should be and adjust it as necessary.

    Code (CSharp):
    1. private float deadZoneAmt = 0.25f;
    2.  
    3. void Update() {
    4.     Vector2 touchCoords = OVRInput.Get(OVRInput.Axis2D.PrimaryTouchpad);
    5.  
    6.     if (touchCoords.x < -deadZoneAmt) {
    7.         // touching left side, strafe left
    8.         transform.Translate(-Vector3.right * touchCoords.x * Time.deltaTime);
    9.     } else if (touchCoords.x > deadZoneAmt) {
    10.         // touching right side, strafe right
    11.         transform.Translate(Vector3.right * touchCoords.x * Time.deltaTime);
    12.     }
    13.  
    14.     if (touchCoords.y < -deadZoneAmt) {
    15.         // touching bottom side, move backwards
    16.         transform.Translate(-Vector3.forward * touchCoords.y * Time.deltaTime);
    17.     } else if (touchCoords.y > deadZoneAmt) {
    18.         // touching top side, move forward
    19.         transform.Translate(Vector3.forward * touchCoords.y * Time.deltaTime);
    20.     }
    21. }
    Edit: Immediately after posting, I remembered that the OVRPlayer object doesn't rotate with your camera view. You may want to store a reference to the camera rig and use its forward axis for the forward movement, and a normalized right value (disregarding roll) to handle the strafing movements. Play around a bit and see what you come up with.
     
    Last edited: Apr 26, 2019
    JessTaylor90 likes this.
  9. JessTaylor90

    JessTaylor90

    Joined:
    Aug 22, 2017
    Posts:
    9
    Thanks! I'll give it a go and report back :)
     
  10. cgarchitekt

    cgarchitekt

    Joined:
    Jan 15, 2017
    Posts:
    26
    is the movement you mention here based on the input from the controllers touchpad or is it if you press the "Fire-Button"? I don't understand that right and I do not understand what you mean with the "toggle for teleport mode".
    I'm searching a solution to shoot a ray to a location I want to teleport and then press the fire button to teleport on that location. Is this exactly what you mentioned in your example above?
     
  11. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,914
    @cgarchitekt The code I shared is for linear movement, not teleporting. To do teleporting, I'd recommend you start with the repo I linked before that (here), and modify it to suit your control needs. You should really only have to change what button is used for the input.
     
  12. cgarchitekt

    cgarchitekt

    Joined:
    Jan 15, 2017
    Posts:
    26
    this does not clarify my thoughts. I'm totally confused.
     
  13. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,914
    Whoops. I meant to link to the repo again, but missed that. Try this: https://github.com/FusedVR/GearTeleporter

    I know it says it's for GearVR, but it works on the Go as well.
     
  14. cjgeorge2005

    cjgeorge2005

    Joined:
    Jul 25, 2019
    Posts:
    1
    On my game, it sent my character able to only move forwards and backwards. I edited the dead-zone to be at 0.005 for it to even move, can someone please give me a working sample code to work off of for my project.
     
  15. cgarchitekt

    cgarchitekt

    Joined:
    Jan 15, 2017
    Posts:
    26
    still very hard for me to use because I am not a programmer
     
  16. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,914
    Well, you have a few options, then.
    1. You could learn a bit of scripting so you can get your project past basic issues like this one.
    2. You can hire a developer to do that stuff for you.
    3. You can buy third party assets that do stuff you want to do and be dependent on them working and doing everything you want out of the box.
    4. You can abandon your dream of making a game.
    I can give you more specific advice on any of those options if you let me know which one you're interested in.
     
    ricardoekm likes this.
unityunity