Search Unity

Google Cardboard look walk

Discussion in 'AR/VR (XR) Discussion' started by lottedr94, Nov 21, 2019.

  1. lottedr94

    lottedr94

    Joined:
    Nov 7, 2019
    Posts:
    1
    Hi guys,
    I'm (kind of) new to unity, I hope you can help me out here. I'm making a VR project and am trying to install Look Walk for Google cardboard. I have the Google VR asset pack and did about 5 tutorials on how to look walk. The tutorial that worked for me still only allowed me to look around with my pointer (holding alt), but when I look forward I don't move forward. When I look down, I fall through my terrain. I already turned off gravity on my player, and afterward rigid body, but the same thing keeps happening and I have no idea how to fix it.
    I hope you guys have any solutions for look walk!

    My script:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class vrlookwalk : MonoBehaviour
    {
    public Transform vrCamera;
    public float toggleAngle = 30.0f;
    public float speed = 3.0f;
    public bool moveForward;
    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)
    {
    moveForward = true;
    }
    else
    {
    moveForward = false;
    }
    if (moveForward)
    {
    Vector3 forward = vrCamera.TransformDirection(Vector3.forward);
    cc.SimpleMove(forward * speed);
    }
    }
    }

    Thanks!
     
  2. unity_u1r5llm6EKEQRw

    unity_u1r5llm6EKEQRw

    Joined:
    Nov 7, 2020
    Posts:
    1
    I am having the same problem and also have not yet found a way to solve it.
    I know almost a year has passed since this question was posted, but I was wondering if you (or anyone else) have found a solution in the meantime.
    Let me know and thanks in advance!