Search Unity

Resources discussing the use of Cinemachine with XR/Virtual Reality

Discussion in 'Cinemachine' started by alexchesser, Jan 27, 2020.

  1. alexchesser

    alexchesser

    Joined:
    Sep 15, 2017
    Posts:
    100
    Hi Folks,

    Not really sure if this is better posted here or within the XR discussion forum. Rolling the dice.

    I've been thinking a bit about how to combine the magic of Cinemachine with a VR game. A few things I'd like to be able to do is move through a few different perspectives: world overview, third person follow, first person.

    Cinemachine brings so much to the table that if I were a non-VR game I would just set a few VCAMS at various points in the scene and adjust the cam-weight at runtime. The complication arises because of how integral that rig setup happens to be with respect to VR.

    Typically in VR you'd see the "center eye anchor" as the main camera, but the left hand and right hand anchors are positioned relative to the C.E.A ... and then the "tracking space" is your safe play zone.

    I think that essentially the entire OVRCameraRig would have to move from one VCAM to another ... but then how would you handle smooth blending between them?

    upload_2020-1-27_15-27-29.png

    I've actually got a million questions about leveraging cinemachine in VR - but - before I run through a couple of weekends doing prototyping and research (for example: do I make my VCAMs children of the CEA? Does that cause motion sickness?) Does head tracking break when you use a VCAM followcam? Maybe if I followcam while leaving LOOK CAM set to null? what if I want *some* player guidance with a set look cam, but I still want them to be able to move their head (effectively making the world at the center-eye update while the player retains full head movement within that guided movement)?

    I'd like to know if there are any resources out there from people who have thought about and solved these problems before? Is there anyone on the internet who's got some insight into the scope of the problem here?

    Is there any thought leadership out there on this topic?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    3,375
    This topic has come up before, and the consensus seems to be something along these lines:
    1. VR rig needs direct control of the camera, so you can't let CM directly control the camera or they will fight.
    2. You can set up CM to control the location of parent of the VR rig, allowing VR to position the camera in relation to that. Do it like this:
      1. Remove the CM Brain component from the Camera, if one is there
      2. Manually add a CM Brain to the parent of the VR rig. Then, any vcams in your scene will drive the transform of that parent object instead of the camera. Blends etc will all function normally, but CM will not be able to control the camera lens (which for VR is the right thing)
    3. Be very cautious with vcam movement, or you may expose your victim to motion sickenss
     
    alexchesser likes this.
  3. alexchesser

    alexchesser

    Joined:
    Sep 15, 2017
    Posts:
    100
    Fantastic answer Gregoryl! Thanks so much :) I'm laughing a little. I did manage to find your other thread on this topic from a few years ago (https://forum.unity.com/threads/vr-follow-player-car.500018/). I'll be sure to turn up the damping on all axes
     
    Gregoryl likes this.
  4. alexchesser

    alexchesser

    Joined:
    Sep 15, 2017
    Posts:
    100
    Hey @Gregoryl I'm trying the follow-cam configuration now and I've got a few questions. I think it's a strong first showing for what I'm *hoping* to get to - but I think there are some configuration things I'm missing. And maybe some odd behaviors from my non-standard config.

    The first thing I've noticed is that the guide rails don't seem to be showing up anymore when working in editor. I think if they were still around I'd have an easier time getting the actual follow behavior I'm looking for.

    When I get ingame on a VR headset
    Here's a quick video of the actual activity - recorded from an Oculus Quest headset


    I'm seeing that I'm not actually staying on one side of the character. I think Ideally I'd like to design for a seated experience where you, stay on the SOUTH side of the character. Notice how at the end of the video I actually have to turn my head 180 degrees to look at the character? And how it's possible to run out-of-frame? Are there settings that will let me always stay "below" the character?

    this is my current VCAM configuration and hierarchy.

    upload_2020-2-9_14-6-28.png
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    3,375
    It's the binding mode. Binding mode controls how the follow offset is interpreted, and SimpleFollow interprets it in Camera-space. Set it to World Space, and then set the offset to be south of the player.
     
    alexchesser likes this.
unityunity