Search Unity

dead zone function not working in timeline

Discussion in 'Cinemachine' started by flapyfox, Jan 30, 2018.

  1. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    I am using Unity 2017.3 and the dead zone function of the cinemachine virtual camera is only working in "Play" mode and not in the timeline scrubber.
    So when playing from the timeline, even if the Aim object is in the dead zone of the camera, the camera still moves when it shouldn't.

    I
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Yes that's true. It's a limitation of Timeline. If you hit the little "play" button in timeline, then it will work correctly outside of game Play mode, but just scrubbing will put the cameras at their "start" positions and not take damping or other dynamic stuff into account.
     
  3. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    I see, but even when I hit the play button it still doesn't work.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    It works on the cameras that are invoked from the timeline. If you don't have a timeline CM clip active under the scrub head and CM is reverting the the normal (outside-of-timeline) game vcam, then that vcam will always be at its "start" position, which is in the center of the dead zone. You have to enter Play Mode to test.
     
  5. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    But I do have a timeline CM clip in the timeline.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Well, it's working for me. Maybe you could put together a little demo package that shows the problem?
     
  7. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    Hey Gregory,
    Here you go, notice how the camera behavior is different in gameplay and in timeline.
     

    Attached Files:

  8. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    I see the problem. You have an animation track on the vcam, not a CM Shot clip. It's the shot clips that activate the cameras. It's like "use this camera now".
    Drag the Unity Camera (the one with the CM brain) onto the timeline to create a Cinemachine Track for it. Then right-click on the track, create a Cinemachine Shot Clip. In the shot clip inspector, set the vcam. Then it will work.
     
  10. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    Ok I will try that but is it possible to pally this for the current virtual camera (spent some time keyframing it and adjusting its values)? Or will I have to do all from scratch?
     
  11. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
  12. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Hi @heavymetalfox,
    1. You can have 2 CM tracks running at the same time: one CM Shot clip to activate the vcam, and a second Animation track to animate its settings. So you just have to add the CM shot to your existing timeline, without redoing anything.
    2. I don't see the issue in your latest video. The camera looks like it's damping.
    3. I imported your project and ran it. It works perfectly, dead zone is respected when scrubbing or playing timeline: https://www.screencast.com/t/AIzjkKK8
     
  13. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    Hey Gregory,
    2- actually this video is not focusing on the dead zone problem, it illustrates another issue where the camera animation in the timeline is different than the camera animation in playmode making it impossible to work with cinemachine. Notice when I hit "play" in the game window how the camera starts at a different place.

    3-regarding the dead zone issue, here is another video that shows the issue:
    Notice how in the first part, all seems correct, camera doesn't move unless the target exits the dead zone.
    Notice how in the second part, the camera starts moving straightway even if the target is still in the dead zone.
    https://masterhotmail.tinytake.com/sf/MjMxODg5MF83MTAyMTgz
     
  14. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    It's because you haven't bound the Cinemachine track to anything. As a result, it's doing nothing. Drag the Unity Camera (the one with the CM brain) and drop it on the indicated spot.
    upload_2018-2-1_11-24-55.png
     
  15. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    Ok it was my bad then, so dead zone issue fixed.
    What about the difference between the timeline and playmode animation? notice in this video how the animation is different and how the camera jumps into a new position when I hit "play" in the gameplay window:
    https://masterhotmail.tinytake.com/sf/MjMxODk0Nl83MTAyMzE5
     
  16. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Right. It probably has to do with the current state of affairs when timeline starts playing. It's different in Edit mode and Play mode, because Play mode starts from nothing, and Edit mode depends on what you were doing when you started playing the timeline. The vcams just carry on from where they are on any given frame. You need to ensure a reproducible start point.

    Try this:
    Create another vcam to serve as the "default" vcam, that is active when timeline isn't activating a vcam. Give it a higher priority. Disable the first vcam activated by timeline (timeline will force-enable it during the clip). I think that will force Edit and Play mode to have the same initial conditions.
     
  17. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    Ok the hack worked , but I had to create a a new vcam and disable both vcams but since it's disabled I cant work with it and animate it anymore. Is there another solution?

    What I need is very simple, I want to have a vcam with an aim target (a sphere that I will animate) and I want to be able to animate the camera position at the same time. Is it something I can do with cinemachine because once I have a cinemachine shot clip in the timeline it overrides the animation track of the same vcam.
     
    Last edited: Feb 1, 2018
  18. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Save the target in the scene at the same spot where it starts in your animation
     
  19. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    I did this (by copying the sphere's transforms from the timeline's first frame), and now the vcam starts at the same position in both timeline and playmode.
    But the animation seems to be different, it seems smoother in the timeline and a bit jerky in the gameplay (its'subtle but I am rendering 4k cienmatic animations so it's still a problem) notice the subtle camera jump in the beginning of the second animation at 0:18, that doesn't happen in the timeline animation where it's smooth :

    https://masterhotmail.tinytake.com/sf/MjMxOTQ1Ml83MTAzMDE1
     
  20. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Kinda hard to see in the video...
    I'm guessing that this has to do with the fact that Unity does not give you a constant frame rate in the editor. Am I to understand that this project is a rendered movie? If so, when you use the Recorder asset to record the movie, you can set it to render at a constant framerate.
     
  21. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    You were right, I recorded the frames and outputed an H264 .mov file, the animation looked like the one in the timeline to my surprise and not the jerky gameplay animation.
    That said, do you think there is a way to have a steady frame rate for the gameplay window avoiding the small accelerations?
     
  22. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
  23. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408
    ok thanks.
     
  24. flapyfox

    flapyfox

    Joined:
    Sep 9, 2008
    Posts:
    408