- Home /
Disabling VR Camera rotation creates ''cinema'' effect in VR device
I am trying to get VR working in Unity together with a Mocap suit. The problem is when I make the camera a child of the head of my Mocap suit (character) within Unity.
The problem is that the OVRCameraRIG is rotating around it's own axis instead of that of it's parent (mocap suit head). When I disable tracking via this script: using System.Collections; using System.Collections.Generic; using UnityEngine;
public class EnableDisableOVRPosAndRotTracking : MonoBehaviour {
public bool useOVRTracking = false;
// Use this for initialization
void Start() {
OVRPlugin.rotation = useOVRTracking;
OVRPlugin.position = useOVRTracking;
}
// Update is called once per frame
void Update() {
}
}
The tracking is disabled, which is what i want because i only want the camera to rotate with the head and not by itself. Because if it does rotate by itself it creates rotation problems and gives you a sort of drunken effect which makes you sick IRL.
The problem with disabling it is that in the Oculus CV1, I see one big screen that renders my camera and everything around it is completely black. It makes you feel as if you're in a cinema....
What did I do wrong and how do I fix this issue.
Answer by Darth-Zoddo · Aug 15, 2017 at 07:26 AM
I tried fixing the problem with multiple scripts etc. Almost everything i tried resulted in the parent of the camera not moving, or the camera not moving when moving the parent. Or it gave me the result with the "Cinema" effect etc.
I came a cross a thread on the unity forum of 2016 where an Oculus dev started to respond to. The thread send me to another thread etc. Until i came across this one: https://forums.oculus.com/vip/discussion/comment/446956/#Comment_446956
I added this script:
using UnityEngine; using System.Collections;
public class FakeTracking : MonoBehaviour { public OVRPose centerEyePose = OVRPose.identity; public OVRPose leftEyePose = OVRPose.identity; public OVRPose rightEyePose = OVRPose.identity; public OVRPose leftHandPose = OVRPose.identity; public OVRPose rightHandPose = OVRPose.identity; public OVRPose trackerPose = OVRPose.identity;
void Awake()
{
OVRCameraRig rig = GameObject.FindObjectOfType<OVRCameraRig>();
if (rig != null)
rig.UpdatedAnchors += OnUpdatedAnchors;
}
void OnUpdatedAnchors(OVRCameraRig rig)
{
if (!enabled)
return;
//This doesn't work because VR camera poses are read-only.
//rig.centerEyeAnchor.FromOVRPose(OVRPose.identity);
//Instead, invert out the current pose and multiply in the desired pose.
OVRPose pose = rig.centerEyeAnchor.ToOVRPose(true).Inverse();
pose = centerEyePose * pose;
rig.trackingSpace.FromOVRPose(pose, true);
//OVRPose referenceFrame = pose.Inverse();
//The rest of the nodes are updated by OVRCameraRig, not Unity, so they're easy.
rig.leftEyeAnchor.FromOVRPose(leftEyePose);
rig.rightEyeAnchor.FromOVRPose(rightEyePose);
rig.leftHandAnchor.FromOVRPose(leftHandPose);
rig.rightHandAnchor.FromOVRPose(rightHandPose);
rig.trackerAnchor.FromOVRPose(trackerPose);
}
}
to my OVRCameraRIG without changing any variables in the hierarchy, and it fixed my problem. This is ideal for multiplayer Mocap, which is what i'm trying to do now. It works with Unity 5.6.3f1
I noticed that there's still a tiny bit of movement when moving the headset, this might cause motion sickness.
Your answer
Follow this Question
Related Questions
How to disable automatic recentering when using OVRCameraRig 0 Answers
Unity Crashing After Building Game 0 Answers
How can integrate Oculus camera script in unity project? 0 Answers
Will my VR project (currently using mouse) run correctly when I return to a PC with a headset? 1 Answer
Oculus Rift S camera offset at start,Oculus rift s offset camera at start 2 Answers