Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Cinemachine Virtual Camera Switch target at runtime in virtual camera, its causing jerk?

Discussion in 'Cinemachine' started by manish191, Oct 3, 2017.

  1. manish191

    manish191

    Joined:
    Jul 6, 2017
    Posts:
    8
    Hi, @Adam_Myhill, I am using cinemachine virtual camera for my racing game. And I am using multiple virtual cameras, to show different views in racing. But I am facing one issue with virtual camera. Its when I am assign a new target from previous target to the virtual camera its suddenly changing the camera position. So its looking like a jerk. Can we have smooth movement when changing from previous target to new target in virtual camera?

    It would be great if you help me on this. Thanks in advance
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,714
    @manish191 It is by design that a target switch on a vcam acts as a cut, not as a blend. The official way, if you want a nice smooth blend, is to have a second vcam on the new target, enable it (or boost its priority), and let the Cinemachine blender make the transition.

    Do you have a special reason why you need to make this transition using a single vcam?
     
  3. manish191

    manish191

    Joined:
    Jul 6, 2017
    Posts:
    8
    Hi, Gregory, Thanks for the response. Actually, I am using Cinemachine for a racing game. Where Player will be running and Also I am using multiple VCam, But the problem is target switching is very frequent in racing. Right Now I am using 6 Vcam to cover full race track. Also If I Use more VCam in game is there any performance issue? suggestion please
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,714
    You can have as many vcams as you like. There is a small cost for each active one, as it will be following its target, but it's not rendering or anything like that. You can eliminate even that cost by disabling the vcams, and only enabling them when you switch to them.
     
    manish191 likes this.
  5. manish191

    manish191

    Joined:
    Jul 6, 2017
    Posts:
    8
    Thanks, Gregory for the response. I will Make sure to enable and disable according to there requirement in game. I will make the change lets see how it will work. Thanks
     
  6. Sutee9

    Sutee9

    Joined:
    Mar 12, 2015
    Posts:
    2
    Cool, exactly the reply I was looking for. Avoids a more complicated path animation!
     
    Gregoryl likes this.
  7. ertsnom99

    ertsnom99

    Joined:
    Dec 5, 2016
    Posts:
    2
    I'm having a similare problem where, in my case, I would like to switch from a virtual camera to an other, but have a transition that follows along a Dolly Track. I'm not sure if I can actually do that, but the reason I want to use a Dolly Track is that my camera is going to move around in a mansion and I would like it to go throw some specific corridors (follow the Dolly Track). The other reason I want to use a Dolly Track is that I don't want my camera to go throw walls.

    If it's not really possible, maybe have one virtual camera on a dolly and changing the follow and look at, but still have it make a transition along the track (I tried just changing the follow and look at by code, but it just cut instead of doing a transition)?
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,714
    Interesting. You want to transition from camera A to camera B, but you want that transition to follow a dolly track.
    What are camera A and camera B doing? Are they also on tracks? Are they FreeLooks, or follow cams, or something like that?
    What do you want the camera to be looking at while it's transitioning back to camera A?

    I can offer this idea, which may or may not be appropriate (I would need more info about your cameras):

    Suppose you make camera C, which is a dolly along the transition track. Set its follow target to be an invisible gameObject, which you will manually lerp from camera A's position to camera B's position - right through walls etc). When it's time to transition, you do this:
    1. Activate camera C (CM will transition from A to C)
    2. Lerp the invisible object from A to B (CM will cause camera C to seek the closest point on the track to the invisible object, but it will stay on the track)
    3. When the lerp is finished, activate camera B (CM will transition from C to B)