Question by
FabioSarti · Jun 22, 2017 at 11:32 PM ·
androidvrmovement scriptfreezecamera movement
Google Cardboard on Unity: Why when I put in the scene "GvrEditorEmulator" the game doesn't go?
I realize a maze, if i don't put in the scene the "gvreditoremulator" the game goes, but when I put it the game freeze.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class controller : MonoBehaviour {
// public GameObject ground;
private bool walking = false;
private Vector3 spawnPoint;
// Use this for initialization
void Start () {
spawnPoint = transform.position;
}
// Update is called once per frame
void Update () {
if (walking)
{
transform.position = transform.position + Camera.main.transform.forward * 3 * Time.deltaTime;
}
if (transform.position.y <-10f)
{
transform.position = spawnPoint;
}
Ray ray = Camera.main.ViewportPointToRay(new Vector3(.5f, .5f, 0));
RaycastHit hit;
if (Physics.Raycast (ray, out hit))
{
if (hit.collider.name.Contains("plane"))
{
walking = false;
} else
{
walking = true;
}
}
}
}
screenprogetto.png
(475.5 kB)
Comment
Your answer
Follow this Question
Related Questions
Gear VR Game keeps crasing on startup when phone is connected to Unity's Profiler 1 Answer
How to switch between Time.unscaledDeltaTime and Time.deltatime after Time.timeScale? 0 Answers
How to resolve object overlap in vr mode? 1 Answer
Unity 2018 Google Cardboard Native - brightness is decreased 0 Answers