Hello everyone!
Soo, I making small VR app where i want to maintain certain level of immerse and i am wondering - what is the best solution for camera clipping trought objects?
Is there any ready solution?
I was thinking about fading into black when collider with wall, but have no idea how to correctly implement it.
Before you even embark upon this issue, make sure you need it. You could also just not care about this. Many games don’t. However, if you want to do it (as we did), here’s my recommendations:
First of all, you need to know when you’re actually in an object and/or a wall. This is not as trivial as it may sounds, since you have two cameras in VR, and each has a local clip plane. So, depending on how precise you want to be, you need two colliders for checking the eyes, not just one. Checking colliders however seems the best approach. If your rooms are mostly rectangular you could use special colliders only for checking out-of-area.
Second, regarding fade-out, I’ve seen various solutions to this from simply blacking out everything to blurring the scene via a post-effect. The issue with fading in general is that it takes time, during which the user may already have passed through the wall and seen something they shouldn’t. It’s easier to just switch directly to a blur and/or black. Going black essentially means adding a second camera which renders on top of (i.e. “before”) the main one, and shows a black canvas.
Third, going black or blurred in itself doesn’t help much in my opinion. The user might be disoriented, or they might have just left the playspace to deal with a toddler emergency. You have to display instructions on how to go back to the place you were before, so I’d recommend having arrows in an on-screen “menu” showing you where to go.