Hello, I’m very new to Unity and VR development. I made a scene in which the main camera in moving linearly inside a tunnel. It works correctly without VR (see it here). However now that I’ve added VR (Vive headset) something strange is happening and I have no idea what is happening (nor how to find a solution since I don’t know where the issue comes from). You can see the vr version here. Basically it looks like the textures are shot far ahead at the start of the animation…when I rotate my head you can see that I’m actually moving correctly inside the tunnel…but the textures are just gone.
I have my camera inside another empty object and I’m using the following code to move the object.
Thank you!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Cam : MonoBehaviour
{
//StartPoint and EndPoint are 2 spheres used to define start and endpoint of the path the camera should follow
public Transform StartPoint;
public Transform EndPoint;
public Controller controller; //joystick to start the animation
float t;
[Range(0.001f,.1f)]
public float speed = 0.1f; //0.0094f
void Start()
{
if (!StartPoint || !EndPoint) Debug.LogError("Put stuff in inspector");
}
void Update()
{
if (controller.getStart() && !endReached()) //if button pressed and we're not at the end of the path
{
t += Time.deltaTime * speed;
t = Mathf.Clamp(t, 0f, 1f);
this.transform.position = Vector3.Lerp(StartPoint.position, EndPoint.position, t);
}
}
//if we reach the end point
public bool endReached() {
return !(this.transform.position.z < EndPoint.position.z);
}
}