Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Cut scene and VR - Pause VR but keep view in Oculus

Discussion in 'AR/VR (XR) Discussion' started by RenOli, Aug 2, 2015.

  1. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    Hello everybody,

    I am trying to make the view in oculus work while the camera is controlled inside cut scenes.

    It is a small demo game I am upgrading from mobile, and has like 3 - 4 seconds cut scenes.

    But the player can't move the camera otherwise he will see all the flaws in the character arms.

    Thanks
     
  2. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    Can't find a solution for that!

    I also don't know how to make others camera in the scene to ignore the movements.
     
  3. bfloch

    bfloch

    Joined:
    Jan 4, 2013
    Posts:
    24
  4. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    Oh no.. that is really bad.. but thankfully there are solutions and tricks for anything in life.

    I made a small script that is almost perfect for that, still didn't make enough test in game.

    On Y angle it works perfectly, the problem is on x and z, that it kinda twist. But, inside oculus rift it is almost unperceptive.

    If anyone wanna try to make it better or use it the way it is, I think it is working.

    Here is the rig I had to do for the camera to stop moving:


    Here is the script:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class FreezeOculus : MonoBehaviour {
    5.     Transform cam;
    6.     public Transform camFather;
    7.     // Use this for initialization
    8.     void Start () {
    9.         cam = gameObject.transform;
    10.     }
    11.  
    12.     // Update is called once per frame
    13.     void LateUpdate () {
    14.         Vector3 newRot = cam.transform.localEulerAngles;
    15.         Quaternion newRotWorld = cam.transform.localRotation;
    16.  
    17.         camFather.localRotation = new Quaternion(-newRotWorld.x, -newRotWorld.y, -newRotWorld.z, 1);
    18.         camFather.localEulerAngles = new Vector3(camFather.eulerAngles.x, -newRot.y, camFather.eulerAngles.z);
    19.     }
    20.  
    21.     void OnDisable()
    22.     {
    23.         camFather.localEulerAngles = Vector3.zero;
    24.     }
    25. }
    I am basically rotating the parent on the opposite side of the camera, on Y it is pretty simple with euler angles, but it is hard to control on X and Z since it seems that on affect the other. But in oculus is almost unperceptive, as I said before.

    Hope someone can make it better, it is just a concept yet.. hhehehee.. but it is working

    Hope it helps someone else.
     
  5. RenOli

    RenOli

    Joined:
    Jan 23, 2013
    Posts:
    102
    All right.. I tested in game... it is working.. not good for my stomach though.. :x like 5 seconds of cg... the head track makes lots of difference for the sickness... Or maybe I am just weak for it.. hahaha