Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

MainCameraVR VRTK conflict

edited December 2016 in Technical Q&A
Hi, once again. Just here for some advice. Anyway, again with the AC VRTK integration. A few days ago when we started tying up the basic stuff (like interaction with the inventory menus and dealing with actual 3D items) we started to worry about getting the VR experience more smooth, so we started to add more VRTK scripts specially made for that, like the Player presence script, which gives the VR player a collider and rigid body to avoid going through walls and to allow them to fall, same with a script for fade to black if the player's camera clips through an object, or stuff to return the player to a safe spot after crouching if they try to stand up when there's no space to do so. Well, we quickly noticed none of those scripts worked at all. At that point we had the [CameraRig] as out player (it had the player script too) and had both Eye and head cameras using the _camera script. I also had a custom action which set the MainCameraVR main camera to follow the eye camera.

At first I tried to check if the Player script was interfering. But soon came to realize VRTK needed the Camera component in the eye to be active for those scripts to work. So, after thinking a bit I turned the Camera eye into the MainCamera by adding that said script. Then deleted the MainCameraVR. Immediately VRTK scripts started to work as intended. But this change created a new issue. 

Basically, we started getting issues getting recognized by triggers, if I recall well, strangely even if tagged as Player, AC triggers would not recognize the auto generated rigidbody and collider created by VRTK. Triggers only worked if we changed the trigger settings to react to any object instead of just Player. So, we decided to parent the rig to an AC Player object and gave that a collider and rigidbody, and that didn't work at first because I noticed the new collider just rolled away, but that made sense, seeing how the room and the actual player(camera eye) are separate in the case of the VR rig. 

So, I ended up having the collider in the Player copy the values from the auto generated collider in the VR rig (in Update). Which kinda works but feels a little hacky. Also, I haven't tested what will happen if there's camera switching for events/cutscenes now that the eye is the MainCamera...

Anyway, Is there a way to keep a MainCamera separate without disabling the camera component in the "eye"?

Comments

  • PS: we've dealt with the trigger issue by marking the main VR rig as Player too. Wish I'd remember what exactly it was that happened though, I just recall we couldn't put the Player script on the rig for some reason, but I've honestly forgotten already, lol. Still I'm still worried about camera switching, which we still haven't had time to test. I'm not sure if the current configuration will clash with the head tracking (seeing how normally the camera follows the person's head movement all the time).
  • AC requires that only one Camera is tagged as "MainCamera".  It will also disable the Camera component on any GameCamera, but if another Camera exists in the scene, untagged and without AC scripts, it will allow it.

    You could try arranging your Hierarchy such that the AC's MainCamera automatically follows the Eye camera, and then set your Eye camera's Culling Mask to Nothing, so that it's still in the scene but effectively displaying nothing.
  • Thanks, I'll give that a try later!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.