GEAR VR Swipe
Hello All
I was using the OVR Player Controller with GearVR and am moving Forward and Back with the touchpad swipes... I can also go Left & Right...
but I want to go UP and Down ..
public virtual void UpdateMovement()
{
if (HaltUpdateMovement)
return;
bool moveForward = Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow);
bool moveLeft = Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow);
bool moveRight = Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow);
#if UNITY_ANDROID
if (GearVRInput.GetAxisY > 0.1f)
{
moveRight = true;
}
if (GearVRInput.GetAxisY < -0.1f)
{
moveLeft = true;
}
#endif
bool moveBack = Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow);
#if UNITY_ANDROID
if (GearVRInput.GetAxisX > 0.1f)
{
moveForward = true;
}
if (GearVRInput.GetAxisX < -0.1f)
{
moveBack = true;
}
#endif
However I'm not sure of the correct semantics, but I don't believe I can because of the way the Player is written by Oculus...
Any Suggestions?
So I decided to try the OVR Camera Rig to do it manually Works in the Game with WASD or Arrows but doesn't translate to Gear
public float speed = 1.0f;
public GameObject myCam;
// Update is called once per frame
void Update () {
bool moveForward = Input.GetKey (KeyCode.W) || Input.GetKey (KeyCode.UpArrow);
bool moveLeft = Input.GetKey (KeyCode.A) || Input.GetKey (KeyCode.LeftArrow);
bool moveRight = Input.GetKey (KeyCode.D) || Input.GetKey (KeyCode.RightArrow);
#if UNITY_ANDROID
if (GearVRInput.GetAxisY > 0.1f) {
moveRight = true;
}
if (GearVRInput.GetAxisY < -0.1f) {
moveLeft = true;
}
#endif
bool moveBack = Input.GetKey (KeyCode.S) || Input.GetKey (KeyCode.DownArrow);
#if UNITY_ANDROID
if (GearVRInput.GetAxisX > 0.1f) {
moveForward = true;
}
if (GearVRInput.GetAxisX < -0.1f) {
moveBack = true;
}
#endif
if (moveForward) {
transform.position += myCam.transform.forward * speed * Time.deltaTime;
}
if (moveLeft) {
transform.position += myCam.transform.up * speed * Time.deltaTime;
}
if (moveRight) {
transform.position += myCam.transform.up* - speed * Time.deltaTime;
}
if (moveBack) {
transform.position += myCam.transform.forward * - speed * Time.deltaTime;
}
}
}
Any Ideas?
Thanks
~ be
Comment