Forum Discussion
Anonymous
7 years agoOculus Go - character movement using touchpad press, in unity3d?
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 ...
radicalappdev
7 years agoProtege
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. Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 years ago
- 1 year ago