Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

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

0404 Posts: 4
NerveGear
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.

Comments

  • LonelyTerminatorLonelyTerminator Posts: 1
    NerveGear
    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

  • radicalappdevradicalappdev Posts: 11
    NerveGear
    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. 


Sign In or Register to comment.