Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Framing Transposer and Smart Update Issue When Not Playing

Discussion in 'Cinemachine' started by BigToe, Jan 6, 2018.

  1. BigToe

    BigToe

    Joined:
    Nov 1, 2010
    Posts:
    204
    I am having an issue with the Framing Transposer and Smart Update when the follow target has a Rigidbody attached to it. It works fine in play mode, but when the game is stopped, the virtual camera won't update correctly. It resorts to a position at the scene origin.

    If I press play and then stop before the ball rolls too much, the virtual camera updates correctly in the editor.

    If I change the update method to Late Update or Fixed Update, the issue goes away.

    I have included a video that shows the problem. Let me know if you have any questions.

     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,208
    Thanks for reporting this. It's a bug relating to Smart Update when it's following physics-animated objects. The camera is never getting updated in edit mode after the system has figured out that the target is physics-animated, since no physics frames are happening.

    There is a simple fix, which will be included in the next CM release. In the meantime, you can patch it yourself, in CinemachineBrain.cs near line 411. Change the code to this:

    Code (CSharp):
    1.         private void OnPreCull()
    2.         {
    3.             if (!Application.isPlaying)
    4.             {
    5.                 // Note: this call will cause any screen canvas attached to the camera
    6.                 // to be painted one frame out of sync.  It will only happen in the editor when not playing.
    7.                 float deltaTime = GetEffectiveDeltaTime(false);
    8.                 msSubframes = 1;
    9.                 UpdateVirtualCameras(CinemachineCore.UpdateFilter.ForcedLate, deltaTime);
    10.                 ProcessActiveCamera(GetEffectiveDeltaTime(false));
    11.             }
    12.         }
     
    Last edited: Jan 11, 2018
    BigToe likes this.
  3. BigToe

    BigToe

    Joined:
    Nov 1, 2010
    Posts:
    204
    Thanks for the fix!