Hello All I purchased UFPS and I'm having nothing but trouble getting the OVR camera rig attached to the Hero. I searched through the forum and UFPS forum and read that there is a way to do it but you have to figure it out until the update 1.7 . I tried dropping it into the main Hero folder and the weapon camera folder but i cant get it to work correctly in the DK2. I'm lost is there any tutorial or anyone that has made it happen that can help ? Thanks for any help
Do you absolutely need to use the OVR camera rig? Unity 5 has built-in VR support.Just tick "Virtual Reality Supported" in your player settings. For UFPS, I use a script like this to make the UFPS character face the direction the player's headset is looking: Code (csharp): using UnityEngine; using System.Collections; /// <summary> /// If using a VR device, when the player moves, this component rotates the player in /// the direction that the camera is looking. Also sets forward rendering in VR mode /// if specified to prevent some image effect issues with deferred rendering. /// </summary> public class VRMoveInHeadsetDirection : MonoBehaviour { public bool useForwardRenderingInVR = true; private vp_FPCamera m_fpCamera; private vp_FPPlayerEventHandler m_fpPlayer; private IEnumerator Start() { yield return null; // Wait 1 frame to let UFPS start up first. m_fpPlayer = FindObjectOfType<vp_FPPlayerEventHandler>(); m_fpCamera = (m_fpPlayer != null) ? m_fpPlayer.GetComponentInChildren<vp_FPCamera>() : null; if (Debug.isDebugBuild) Debug.Log("VR Device: " + UnityEngine.VR.VRSettings.loadedDevice + " (enabled=" + UnityEngine.VR.VRSettings.enabled + ")"); var isVREnabled = UnityEngine.VR.VRSettings.enabled && (UnityEngine.VR.VRSettings.loadedDevice != UnityEngine.VR.VRDeviceType.None); enabled = isVREnabled && (m_fpPlayer != null) && (m_fpCamera != null); if (enabled && useForwardRenderingInVR) { m_fpCamera.GetComponent<Camera>().renderingPath = RenderingPath.Forward; m_fpCamera.enabled = false; // Refresh the camera settings in forward mode. yield return null; m_fpCamera.enabled = true; } } private void Update() { if ((m_fpPlayer != null) && (m_fpPlayer.Velocity.Get().magnitude > 0.1f)) { m_fpPlayer.Rotation.Set(new Vector2(m_fpPlayer.transform.rotation.eulerAngles.x, m_fpCamera.transform.rotation.eulerAngles.y)); UnityEngine.VR.InputTracking.Recenter(); } } }
Hello TonyLi Thanks for the response I will try it when I get home . The only reason why I thought I needed the OVR Camera rig was because the dk2 does not turn on in unity when I press play if I dont have the OVR rig in the scene . Should it be turning on with just the Check in the settings ? Thanks
Yes. I recommend creating a new Unity 5.3+ project and importing Unity's VR Samples. This is a good way to start experimenting with Oculus in Unity. Don't import it into your UFPS project. VR Samples is a complete project asset; it would overwrite your UFPS complete project settings.
Hello I have had a chance to play with the VR samples they are great. So I found out why the dk2 was not turning on when I pressed play without the ovr cam rig in the scene. My settings were on dx9 instead of dx11 . I updated that and now the dk2 turns on when I press play with no ovr cam rig . But now i can actually see my body instead of being connected to it in the head position . Will the script above fix that ? I have already created it but Im not sure where to put it . Thanks
Try this script. I just tested it with the Hero prefab, and it works fine. Code (csharp): using UnityEngine; public class VRMoveInHeadsetDirection : MonoBehaviour { private vp_FPCamera m_fpCamera; private vp_FPPlayerEventHandler m_fpPlayer; void Start() { m_fpCamera = FindObjectOfType<vp_FPCamera>(); m_fpPlayer = FindObjectOfType<vp_FPPlayerEventHandler>(); enabled = UnityEngine.VR.VRSettings.enabled && (m_fpCamera != null) && (m_fpPlayer != null); } void Update() { if (m_fpPlayer.Velocity.Get().magnitude > 0.1f) { m_fpPlayer.Rotation.Set(new Vector2(m_fpPlayer.transform.rotation.eulerAngles.x, m_fpCamera.transform.rotation.eulerAngles.y)); UnityEngine.VR.InputTracking.Recenter(); } } }
Hello TonyLi I tried the script above and it seems to be putting the camera in the correct place. The problem I'm noticing is I am getting a fish eye view effect in the dk2. Example: when I walk up to a wall and look up instead of getting the feel of height from the wall it bring the top of the wall right in front of me as if I'm standing in front of the top of the wall . When I use the OVR camera rig it gives size and scale to everything in the scene correctly . Is there a way to take the fish eye effect off the hero or apply the OVR camera rig to the hero ? Thanks
It's probably best to bring this to the UFPS forum to get advice from UFPS experts. I don't think it would be easy to apply the OVR camera rig to the UFPS hero. Check the settings on the OVR camera against the settings on Hero/FPSCamera. Maybe the FOV (field of view) is different, or maybe FPSCamera has some extra post-processing effects.
Hello Thanks for the Info above I will go through the settings and see if I and find the differences. I posted in the UFPS forum a while back still no answer yet . Do you have any suggestions for any fps assets in the unity store that may provide a easier integration of the OVR camera rig or a better option to use for the FPS camera ? Thanks
If you don't need weapons and a body, I've found that Unity's standard FirstPersonController works great in VR. Otherwise try importing only UFPS into a completely new, empty project. (Don't import the OVR camera rig package.) Then tick the Player Settings > Virtual Reality Supported checkbox and load up a scene with the Hero. It should work fine. If it does, try adding the VRMoveInHeadsetDirection script I posted above if you want to add that kind of behavior.
Hello So I created a new project and imported UFPS . I clicked the VR setting the dk2 turns on fine but Im getting the fish eye effect. You said above to try the FirstPersonController if I don't need a weapon or body . What do you think would be the best option if I do need a weapon ? Do it without the body and maybe just the arm/arms? If that is the case any suggestions on the best way to do it ? Thanks
I don't see the fish eye effect. Do you see the same thing with Unity's standard FirstPersonController?
I just deleted the hero from the scene and tried the FirstPersonController in the scene and it looks good no fish eye effect everything is the correct size . Would I be able to add the settings from the Hero to the FirstPersonController ? Everything but the fish eye effect of course. 2/26/2016 forum
Hello So after playing with it a bit I think its the FP_Camera script that is causing the fish eye effect. I would delete it but I need it for most the functions. Any idea what I can do to fix it ? Thanks
0l,.. Hello I tried the FOV slider did not seem to effect the curve fish eye lens effect . If I use the FirstPersonController will i be able to apply all the scripts from the hero to the FirstPersonController and it will work as if Im using the hero ?
Sorry, I don't think so. They're quite different. But perhaps you can compare the FirstControllerController and UFPS cameras for differences that might explain the fish eye effect that you're seeing.
Did anyone ever successfully get the guy to rotate properly depending on where you look? I cant get it working, im using OSVR, and above solution but he just spins around and around.