Forum rules - please read before posting.

VR camera changes when scene changing

OK, so I got the camera to work in VR mode perfectly on the start of the game.
But when I scene change it moves the view to outside the and away from the player. Is there a way to keep this locked to the player or reset on each change? I have attached a video link showing my setup and that it works great on start, but after scene change,even back to original scene it is all off center and just doesn't work correctly.... Please keep in mind I am no coder so am unable to write my own script if that is what is required.

Comments

  • You can see that when selecting the MainCamera after the scene change, the Attached camera field is set to None.  This will normally be set to the Player's FirstPersonCamera child component, but as you're using your own camera method it's not happening - so you'll need to make the switch manually by using a Camera: Switch Action in your OnStart Cutscene.

    Drag the Player prefab into your scene, make the Camera: Switch Action and switch to the Player's camera.  AC will give it a ConstantID component so that it can be found outside of the scene (necessary for instantiated prefabs).  Find the ConstantID component, then check Retain in prefab? on it, Apply the changes and remove from the scene.
  • edited November 2016
    Not sure I did it correctly but it is better, just have to work on getting it to NOT clip through the walls and ceiling of the entrance tunnel. (doesn't clip in normal play, I am sure there are contraints I can use for the VRrig, just have to look those up)
    I added the player to the scene. On the CAMERA EYE child I added the firstpersoncamera script (Had to, AC would not recognize anything as a caera without it).
    Then on my onstart I added the camera switch to the CAMERA EYE.
    On the Camera rig itself I added the constant ID (there wasn't one added automatically) and selected RETAIN IN PREFAB. applied all and then deleted character and saved scene.
    It seems to work better.
    Just need to figure out the look direction as being forward (move to where you are looking so forward is always where you look), I saw a post on this and a guy had a lone to add to the script but didn't say where to put it.

    EDIT:
    Wait, ignore that..need more testing..seems I might be a little bit of an idiot!
    When I do your onstart logic to set it to the camera it doesn't see it, it says constant ID not found, it looks for the camera before the player is in the scene with the camerarigconstantID tag...
    (I did remove your cameraVR setup and only using the camera rig from the steamVR prefab...so far it seems OK however that's only if the player is already in the scene, if I spawn him it says no rendering camera)
    My workstation is outside the play area...and the game was starting based on the headset location in world space so I was seeing through the walls! When I put on the headset and stood in the middle, it looked perfect, just have to figure out how to stop from looking beyond the playspace into the world beyond though. and how to move there I am looking.
  • Question..Do we need the main camera provided or can we just use the steamVR camera rig name it maincamera, attach to the player and just use that?

  • AC's MainCamera is required to be present, but you can disable it through a script if you need to - see the UltimateFPSIntegration script to see an example of how it's done for UFPS.

    You shouldn't need to do this, however - if you attach a "_Camera" component to your SteamVR camera, AC will be able to "see" it in Actions etc - see Section 4.6 of the Manual.

    One other thing to consider is placing the SteamVR Camera rig onto the MainCamera itself - but you will still need to switch to the player's camera.
  • edited November 2016
    Thanks for your help.
    I am doing it in small steps, went back to trying to get the outside start level working before I work on scene changes now.
    I now have it where the head movement is accurate and correct, controllers are tracked, I can use either controller with a laser pointer to move around the world (the player, not just the camera rig) and also put an object in the scene and am able to interact with it, it changes color and highlights when I target it and when I click it disappears (I guess I pick it up but still can't see inventory..guessing it has to be a world space HUD or something not the AC to work)...

    I get the yellow error [CameraRig} has no camera component but it does have the _Camera script on it

    Edit:
    Progress so far

  • The Camera and _Camera components are different - add the standard Unity Camera component as well.  AC will automatically disable it when active.
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.