cancel
Showing results for 
Search instead for 
Did you mean: 

Oculus Go - character movement using touchpad press, in unity3d?

Anonymous
Not applicable
my end goal is to be able to move character forward, backward, and strafing left and right by detecting where you are touching on the touchpad and if you are pressing in on the touchpad (and not just touching it).

using something like if OVRInput.Get(OVRInput.ButtonTouchpad); to see if you are pressing in on the touchpad.
also OVRInput.Get(OVRInput.Axis2.PrimaryTouchpad); to see where you are touching, and then setting up values that will move you in the proper direction. 

i am pretty new to unity and game development. but if anyone could help me wrap my head around how to set this up it would be much appreciated. to at least get me on the right track.
4 REPLIES 4

LonelyTerminato
Honored Guest
Have you figured This out? I want the exact same locomotion as you, so far i'm only able to take a step everytime I swipe in the direction I want to go but I'd love to be able to move freely with the touch presses in the direction I want to go because I have to tell you swiping to get everywhere in my game has to change haha

radicalappdev
Protege
I found a simple way to do this. It's far from perfect and needs to be refined, but it's good enough for me to get started.






public class PlayerMove : MonoBehaviour

{

    public float moveSpeed = 10.0f;
    public GameObject cameraRig;
    public GameObject centerEye;
    private Vector2 touchpad;

    void Update()

    {

        //Player movement
        touchpad = OVRInput.Get(OVRInput.Axis2D.PrimaryTouchpad);
        transform.eulerAngles = new Vector3(0, centerEye.transform.localEulerAngles.y, 0);
        transform.Translate(Vector3.forward * moveSpeed * touchpad.y * Time.deltaTime);
        transform.Translate(Vector3.right * moveSpeed * touchpad.x * Time.deltaTime);
        cameraRig.transform.position = transform.position;

    }

}
  I used the CameraRig. Make sure to drag the camera rig and center eye objects into the slots in the inspector. 

fgj340jxrx39.png

oculusgoturner
Honored Guest



pedromasa
Honored Guest
@radicalappdev I tried just the same as you but I cant make it work... This is going to make me crazy.
Could you help me?