Search Unity

GearVR Movement bug?

Discussion in 'AR/VR (XR) Discussion' started by fooldome, Feb 17, 2017.

  1. fooldome

    fooldome

    Joined:
    May 29, 2012
    Posts:
    9
    Hello fellow developers,
    has anyone experienced a strange bug when building for Android GearVR that restricts movement to only 1 direction?

    so I have this code which in editor and on PC builds works perfectly, if I look in the left direction, I move toward it, if I turn around and look in the right direction, I'll move toward that.

    if (left && move) {
    Player.transform.Translate ( Vector3.left * Time.deltaTime * Speed, Space.World);
    }
    if (right && move) {
    Player.transform.Translate ( Vector3.right * Time.deltaTime * Speed, Space.World);
    }

    Simple. However when I build for Android and test on GearVR, it works in only 1 direction. If I look left, I'll move left but if I look right I'll still move left!
    Have been trying to solve for days with no joy, does anybody have any insight??
     
  2. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    Vector3.left and Vector3.right are static values, and will always be the same.

    Make sure the Main Camera is a child of another gameobject, and move the parent object. You will need to check the camera's transform.forward (or left or right).
    Player.transform.Translate ( Camera.Main.transform.forward * (Time.deltaTime * Speed));

    Here's my movement tutorial playlist:
    https://www.youtube.com/playlist?list=PLHQUlKGE3pvz5-8aDjy6pral6ash4-JKu

    And Pack:
    https://www.assetstore.unity3d.com/en/#!/content/69041