OSVR / OSVR-Unity

Package for authoring OSVR experiences with Unity.
Apache License 2.0
99 stars 38 forks source link

Missing camera components? #102

Closed ImperialPenguin closed 8 years ago

ImperialPenguin commented 8 years ago

By default, creating a camera in Unity adds three components in addition to the camera. A flare layer, a GUI layer, and an Audio Listener. Shouldn't the VRDisplayTracked prefab also contain those things? I'm thinking the Audio Listener should go on VRDisplayTracked itself and the other two should be added to VRViewer0, and any additional VRViewers that are created.

DuFF14 commented 8 years ago

I don't think adding those components would have any downside, but I'm not sure if they are necessary either. The GUI Layer was marked as Legacy after the new Unity UI system was implemented. I don't think Lens Flares make sense in VR, but I could be wrong about that and haven't experimented with that effect. The new Unity VR Samples project does include those layers on their MainCamera, which might be a good reason to include them in this project, but I'm not sure if there is any reason they are included.

There is some code that adds an AudioListener: https://github.com/OSVR/OSVR-Unity/blob/master/OSVR-Unity/Assets/OSVRUnity/src/DisplayController.cs#L265

This code should probably check the whole scene for an AudioListener (FindObjectOfType), rather than just the VRViewer gameobject, because there can only be one per scene. I think the AudioListener should go on VRViewer because it rotates with the head, which is important for 3D audio. Of course something will have to budge if there are multiple VRViewers in the scene and they should each have "ears", but for the moment we can punt on dealing with multiple VRViewers and assume there will be one for now.

ImperialPenguin commented 8 years ago

That makes sense. I suppose I was overthinking things.