dhartwich
dhartwich

Reputation: 398

CharacterController.SimpleMove not working on Daydream View

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);
  }
}

Upvotes: 2

Views: 786

Answers (1)

NurFACEGAMES
NurFACEGAMES

Reputation: 11

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

Upvotes: 1

Related Questions