2

I am trying to use a LookToWalk script in my Unity VR app that should run on my Daydream View. In the "Game" Mode to preview the changes everything works as expected (I configured the script to run forward once the user camera faces 30.0 degrees downwards or more. However when I try to build the daydream app and install it on my Google Pixel the CharacterController.SimpleMove doesn't seem to work any more. The logs were showing that the 30.0 degree stuff was triggered as expected but no movement was seen on the daydream.

Do you know why this could be happening? Seems really strange that it runs on the "emulator" but not the 'real' device.

using UnityEngine;
using System.Collections;

public class GVRLookWalk : MonoBehaviour {
  public Transform vrCamera;
  public float toggleAngle = 30.0f;
  public float speed = 3.0f;
  private bool shouldWalk;
  private CharacterController cc;

  // Use this for initialization
  void Start () {
    cc = GetComponent<CharacterController>();
  }

  // Update is called once per frame
  void Update () {
    if (vrCamera.eulerAngles.x >= toggleAngle && vrCamera.eulerAngles.x < 90.0f){
        shouldWalk = true;
    } else {
        shouldWalk = false;
    }

    if (shouldWalk) {
        Vector3 forward = vrCamera.TransformDirection (Vector3.forward);
        cc.SimpleMove (forward * speed);
  }
}
dhartwich
  • 398
  • 2
  • 6
  • 16
  • Seems like all movements with the CharacterController seem to be flawed or not able to run on the Daydream View, does someone have experience with moving in VR and Daydream VR? How is this solved? – dhartwich Dec 12 '16 at 13:52
  • If I wanted to guess, I'd say your camera is not attached to your character. – Ali Dec 12 '16 at 16:18

1 Answers1

1

Is the Camera a child of another transform? You cannot move the camera directly. "you cannot move the camera directly in Unity. Instead, the camera must be a child of another GameObject, and changes to the position and rotation must be applied to the parent’s Transform." https://unity3d.com/learn/tutorials/topics/virtual-reality/movement-vr

  • Hey NurFACEGAMES yes it is since, you described it would be pest to place the Camera inside a game object, should the "MainGame" Object contain the CharacterController? – dhartwich Dec 12 '16 at 20:24
  • CharacterController should be on a 'VRMain' gameobject that is parent of MainCamera. Tutorial here: https://www.youtube.com/watch?v=JmgOeQ3Gric and even faster solution here: https://www.assetstore.unity3d.com/en/#!/content/69041 – NurFACEGAMES Jan 05 '17 at 19:58