Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add camera components to VRSurfaces #101

Closed

Conversation

ImperialPenguin
Copy link
Contributor

Better duplicates the main camera so that its image effects and other components are carried over by instantiating a copy of its GameObject and deleting unneeded components/children. This resolves #75

Better duplicates the main camera by instantiating a copy of its
GameObject and deleting unneeded components/children.
@ImperialPenguin
Copy link
Contributor Author

Sorry, my Unity project didn't update correctly and this code won't work. The camera has moved since I started my project. I'll fix it and resubmit.

@DuFF14
Copy link
Member

DuFF14 commented Dec 21, 2015

I think this method will work, with some modification (other than what you've already noticed with the MainCamera moving to VRViewer). Not every component that's attached to VRViewer should be copied to VRSurface. For example, in the Unity VR Samples project, there are a bunch of scripts (VREyeRaycaster, VRInput, VRCameraFade, etc.) that would belong on VRViewer but not on each VRSurface.

I think a similar solution to what you've come up with here could work, but it would require adding another gameobject/component to the hierarchy (call it CopyToVRSurface, for example). One could attach any Image Effects and other components that should be on each VRSurface to this new gameobject, then duplicate it and add a VRSurface like you've done here. Delete the object afterwards, or delete it if there aren't any components to copy. You can still copy the camera component from VRViewer with the existing CopyCamera function. Hopefully this makes sense.

@ImperialPenguin
Copy link
Contributor Author

Hmm. It seems like that brings up another problem then. The first VRViewer is created for them, but the code is setup to create additional VRViewers if needed. I'm not exactly sure why there would ever been a need for more viewers, more than two eyes, or more than one surface per eye, but the code supports it so any solution would need to as well. So if a VREyeRayaster, for example, is added to VRViewer0, and another VRViewer gets created by the code, it would lack that component. The VRViewers themselves could be created by instantiation.

A CopyToVRSurface game object would work, but it would make things convoluted. As would anything that requires setting up the camera components manually. Camera components are visual in nature, so they are usually applied to the camera and tweaked there. Most of them probably require a camera component, so I'm not sure they can be put in another GameObject without also giving it a camera, which would be necessary for the instantiation process anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copy image effects/components to each VRSurface camera.
2 participants