- Home /
Movement with Oculus Go
Hey ! So I'm trying to make an environment work, and to do that I need my character to be able to move in VR. The problem is, that sometimes it works well, and right after I can't move forward, like I'm blocked by an invisible wall, I'm pushed back, to the left, etc. and I don't understand where it comes from ! It's very frustrating. I took the OVRPlayerController from the Oculus Integration asset, and added a movement script with this code in it :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UserMovement : MonoBehaviour
{
public Vector2 joystick;
public GameObject centerEye;
public GameObject OVRCamera;
public float speed = 5f;
public Vector3 offset = Vector3.one;
// Update is called once per frame
void Update()
{
joystick = OVRInput.Get(OVRInput.Axis2D.PrimaryTouchpad);
transform.eulerAngles = new Vector3(0, centerEye.transform.localEulerAngles.y,0);
transform.Translate(-Vector3.forward * speed * joystick.y * Time.deltaTime);
transform.Translate(-Vector3.right * speed * joystick.x * Time.deltaTime);
OVRCamera.transform.position = transform.position + offset;
}
}
Also, sometimes I'll be able to go through walls when it's clearly not supposed to. Anyone can help me please ?
Your answer
Follow this Question
Related Questions
anybody working on gear vr oculus ? 0 Answers
Unity for OculusGo: Move an object along the z axis by touchpad 0 Answers
Unity Crashing After Building Game 0 Answers
TMP InputField Caret missing in VR Oculus Quest but works fine in editor using Oculus UIHelpers 1 Answer
Socket for Oculus Interaction SDK? 1 Answer