CineMachine and Framerate

Unity 2017.4.2f2 // CineMachine 2.1.10 (with fix for Animator Override Controller, kindly supplied earlier)

I have a CineMachineStateDrivenCamera driving two third person view virtual cameras - ground based and ‘flight’ based cameras. I use the mouse/joypad to rotate around the player. All working well and moving between the two nicely.

However, I’ve come across an issue where it appears that the X and Y axis max speeds of the cameras don’t appear to be framerate independent.

I had it running really well on my local dev system, but on my client’s low-end system, where the framerates are lower, the control of the camera rotation are far too sensitive. This made me wonder if the max speeds are not framerate independent and if there’s a workaround?

I’ve tried playing with the settings in CineMachine Brain (Ignore Time Scale and Update Method) but nothing seems to work.

Obviously, ideally, I want to rotate the camera at the same speed regardless of framerate. Any help or advice appreciated!

Sorry for the delayed response.
The code in question is in AxisState.Update(). It’s taking deltaTime into account when applying acceleration to the axis. DeltaTime will vary with the framerate, so the acceleration strength is framerate-dependent, but the max speed is not. What are your axis settings?

I am getting similar issues. In the editor, where my framerate is lower, the sensitivity seems fine the way I have it set up. When I build and test and the framerate is much higher there is a very noticeable difference in sensitivity for both X and Y.

I am using Cinemachine Free Look. Y Axis Max Speed of 4 and X Axis Max Speed of 500. I am using 0.1 Acceleration and Deceleration times for both axes, but I tested it with both times set to 0 as well and still noticed the problem.

Any suggestions?

One possibility is to completely replace the way the axis value is driven.

Here is a little script that does exactly that. It makes use of a new feature in CM 2.2.9: CinemachineInputAxisDriver, which is an alternative input axis driver giving a snappier mouse response.

Add this script to your FreeLook and give it a spin. Let me know how that goes.

4632451–434386–FreeLookAxisDriver.cs (1.54 KB)

2 Likes

Hey there! I have also have this kinda issue. I am using “Cinemachine touch Input mapper” to get values of x and y axis;
Touch seems to be so responsive. With a little drag on android touch screen, CM camera moves so quickly, even my x and y speed are 10 or less. Is there any solution to this?
Here is how x and y axis’s values are driven

public class CameraManager : MonoBehaviour
{

    public float TouchSensitivity_x = 10f;
    public float TouchSensitivity_y = 10f;
    public bool canControlCamera = false;

    // Use this for initialization
    void Start()
    {
        CinemachineCore.GetInputAxis = HandleAxisInputDelegate;
    }

    float HandleAxisInputDelegate(string axisName)
    {
        if (canControlCamera)
        {
            switch (axisName)
            {

                case "Mouse X":

                    if (Input.touchCount > 0)
                    {
                        return Input.touches[0].deltaPosition.x / TouchSensitivity_x;
                    }
                    else
                    {
                        return Input.GetAxis(axisName);
                    }

                case "Mouse Y":
                    if (Input.touchCount > 0)
                    {
                        return Input.touches[0].deltaPosition.y / TouchSensitivity_y;
                    }
                    else
                    {
                        return Input.GetAxis(axisName);
                    }

                default:
                    Debug.LogError("Input <" + axisName + "> not recognyzed.", this);
                    break;
            }
        }

        return 0f;
    }

    public void SetCanControlCameraValue(bool val)
    {
        canControlCamera = val;
        print(val);
    }
}

Can you try out the new feature in CM 2.4.0? It offers better axis control and may solve the problem for you.

5342466--539217--upload_2020-1-6_11-23-31.png

Thanks for replying so fast. I found the solution to problem today. I have updataed CM to CM 2.4 preview. Btw I dont have any idea of this new option. Anyway thanks!

I am using CineMachine POV for an FPS game. I have no scripts for looking around. CineMachine is taking mouse input and rotating the camera. I am currently using Input Value Gain, and the sensitivity is okay. Is this framerate independent? If not, how can I fix it so that my camera movement becomes framerate independent?

It is supposed to be framerate-independent

1 Like

I am using Cinemachine Free Look with Input Value Gain, Mouse X / Y axis, and cinemachine brain set to fixed update. But I can clearly feel that with lower FPS the camera rotation is faster. In particular, the Input Axis Values are much higher at lower FPSs.

Is there a fix for that?

It turns out that there is a CM bug related to framerate that produces this effect for FixedUpdate cameras. It’s been fixed on the CM main branch, and will be part of the next CM release.

1 Like

Got it, thanks

Do you happen to have a date for the release?
Will it also be part of a verified package for Unity 2020.3.x versions?

Thank you

Yes we are planning a backport of this fix to 2.6.x and 2.7.x. Don’t have a date yet.

1 Like

Hi!
I had the same problem.
However, choosing “Input Value Gain” instead of “Max Speed” as the Speed Mode solved the problem for me.

Hello! I might be having the same issue? I’m in 2020.3.17f1 and in the editor the FreeLook movement is maybe twice as fast. I’ve taken much of the advice above, changed to Input Value Gain and I’ve updated CM to 2.6.11, but here’s an example, macOS and PC builds are (thankfully) the same, but in editor…
https://www.dropbox.com/s/lgtkdapwup9txcg/Camera sensitivity demo.mp4?dl=0

Hi, just to be sure, was this ever backported to 2.6.x? I’m having issue with my CM freelook cam, where the speed looks very different depending on framerate, even though I’m using “Input value gain” mode

Thanks!

Yes it was. What version of CM are you using??

Thanks for the reply, the problem was on my side!
Turns out controlling the axis of the Freelook mouse vs. controller joystick required a lot more fine tuning that I expected!

We can switch between Mouse and controller input on the fly in my game, and this was causing issue, I needed to process the input differently depending on the device used!

1 Like