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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Jerky camera with Orbital Transposer on rigidbody target

Discussion in 'Cinemachine' started by Aceria_, Nov 21, 2018.

  1. Aceria_

    Aceria_

    Joined:
    Oct 20, 2014
    Posts:
    81
    We have a top down (ish) game where the player can rotate the camera using the right mouse button.

    This is how it looks like:


    We have a Cinemachine Virtual Camera set up like this:



    The Look At & Follow are both rigidbodies (these are the player, both are set at runtime). The Cinemachine Brain Update Method is set to Fixed Update.

    Whenever the game is played at 60FPS, the camera behaves fine. Rotation is smooth and remains smooth when the player walks. However, in a build the FPS easily hits 200+ and that's where the problem lies. When you try to rotate the camera, it is very slow and feels sluggish. If I set it to Smart Update, the rotation is smooth, but when you start walking it looks like the character stutters (it's not actually the character stuttering, but the camera not updating and then jumping back to catch up I guess).

    I'm not sure how to solve this problem, as all my attempts have either resulted in my first issue or in the 2nd issue. Right now the only "solution" we have is locking the framerate to 60, which we don't want to do.

    Does anyone have a similar system who can share their result?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,240
    hmmm... it could be that the axis update is framerate-dependent.
    You could bypass this by writing your own axis update script and attaching it to the vcam.
    Just set the Input Axis Name to nothing, and have your script directly manipulate the Orbital's m_XAxis.Value field.
     
  3. eyeballTickler

    eyeballTickler

    Joined:
    Jun 13, 2015
    Posts:
    7
    I'm also noticing this issue. I tried what you recommended, @Gregoryl (see snippet below), but there is still jitter when using an Xbox joystick, albeit a smaller amount. I've also tried switching the Update Method property on the Cinemachine Brain but to no avail. Looking at Cinemachine's AxisState.cs's Update function, it seems like deltaTime is already being taken into account. Any other thoughts? Or should I file a bug?

    My snippet which I've tried calling in both Update and LateUpdate:

    _orbitalTransposer.m_XAxis.Value -= (rotateDelta * rotateSpeed * Time.deltaTime);
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,240
    If the camera target is a RigidBody, then the camera is being updated in FixedUpdate.
    At very high framerates, you'll get multiple calls to Update/LateUpdate per FixedUpdate frame.
    When is your code snippet executing?