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.

Bug At certain values the Cinemachine Virtual Camera oscillates at high speed during transitions

Discussion in 'Timeline' started by tsujihaneta, Feb 6, 2023.

  1. tsujihaneta

    tsujihaneta

    Joined:
    Jun 8, 2017
    Posts:
    15
    Thank you for your assistance.

    Jitter occurs in the following environments.

    Unity2022.2.0f1
    Cinemachine 2.9.5 (also occurs in earlier versions)

    First, set the parameters for the Cinemachine virtual camera as follows (This is just an example)

    VCamA
    Arbitrary Transform
    I have set Follow and LookAt to the appropriate Sphere, etc.

    VCamB
    Transform Position 0,15,0
    Transform Rotation 90,0,0

    I set CinemachineBrain on the MainCamera
    Timeline Cinemachine track to transition from VCamA to VCamB.

    The camera vibrates at high speed, probably because the rotation direction is not fixed.
    No other scripts are used.
    Set the following values to prevent the vibration.

    VCamB
    Transform Position 0,15,0
    Transform Rotation 90,1,0

    This does not occur in the timeline preview when not in PlayMode.

    Is this a bug?
    Please let me know if there is a way to fix this, such as rotating the camera in any direction.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    6,874
    It looks like you are running into Gimbal Lock. This occurs when cameras are look straight up or down. An easy fix would be to stay away from +-90 in X rotation. Can you use 89?

    If you absolutely need 90 degrees, there are some vcam components that are less susceptible to gimbal lock. We would have to look at your specific use-case in order to make a good choice.
     
  3. tsujihaneta

    tsujihaneta

    Joined:
    Jun 8, 2017
    Posts:
    15
    Thank you for your reply.

    Yes, I believe it is derived from the gimbal lock.
    I am aware of the gimbal lock and wanted to know if this behavior is as expected when the corresponding value for gimbal lock is entered in Cinemaschine.

    I would like to use the VCam component as available in the 90, as I need a look down perspective.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    6,874
    Can you describe the use case? Is the looking-down the only camera? Will there be others looking at other angles? Will the camera be static, or will they do procedural following? Can you show some inspectors? Can you show an image of the content?
     
  5. tsujihaneta

    tsujihaneta

    Joined:
    Jun 8, 2017
    Posts:
    15
    Sorry I can't provide screenshots, but I am creating a cutscene using timeline.
    It goes from a VCamA staging camera back to a VCamB looking down camera. Also, no other VCam is used.
     
  6. tsujihaneta

    tsujihaneta

    Joined:
    Jun 8, 2017
    Posts:
    15
    provide a screenshot

    upload_2023-2-7_2-16-14.png
    upload_2023-2-7_2-16-21.png
    upload_2023-2-7_2-16-27.png
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    6,874
    I've set it up as you've shown and am not getting any problems. The blend is correct.
    Would you like to send me a simple test project that reproduces the issue?
     
  8. tsujihaneta

    tsujihaneta

    Joined:
    Jun 8, 2017
    Posts:
    15
    This way. Best regards.
    Please Install Cinemachine.
     

    Attached Files:

  9. tsujihaneta

    tsujihaneta

    Joined:
    Jun 8, 2017
    Posts:
    15
    I set the VCamA Aim Dead Zone Width to 0.1 and the jitter disappeared!
    This may be because there is now more leeway in limiting the range of motion.
    We would like to inform you in advance.
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    6,874
    Thank you for that upload and for the Dead Zone info, it is very helpful. I see the issue now. We will look into addressing it. In the meantime, is setting the dead zone to a small value a suitable workaround for you?
     
  11. tsujihaneta

    tsujihaneta

    Joined:
    Jun 8, 2017
    Posts:
    15
    Thank you for your reply.
    Yes, I am sure that I have achieved my goal. My objective has been achieved, so for the time being, this is the best way to deal with the problem.
     
    Gregoryl likes this.