Some issues with an orbiting free look camera setup

I’m having some issues with an orbiting free look camera setup I’m using in my project. The goal is to have a camera orbit an object based on mouse movement when the left mouse button is pressed. My Cinemachine version is 2.2.7 and Unity is 2018.2.9f1. I’m having two issues currently:

  • In a build, orbit speed is much slower
  • In a build, orbiting can get “stuck” and never fully stop (though it gets close)

I don’t have the above issues in the editor. Here is my virtual camera setup:

4040773--350719--upload_2018-12-27_15-12-53.png

4040773--350722--upload_2018-12-27_15-13-17.png

4040773--350725--upload_2018-12-27_15-13-39.png

4040773--350728--upload_2018-12-27_15-13-57.png

To enable/disable orbiting I do the following:

cinemachineFreelook.m_XAxis.m_InputAxisName = "Horizontal";
cinemachineFreelook.m_YAxis.m_InputAxisName = "Vertical";

and

cinemachineFreelook.m_XAxis.m_InputAxisName = "";
cinemachineFreelook.m_YAxis.m_InputAxisName = "";

cinemachineFreelook.m_XAxis.m_InputAxisValue = 0;
cinemachineFreelook.m_YAxis.m_InputAxisValue = 0;

Of course horizontal and vertical input is set to mouse movement in the input manager.

Any idea how I can fix this?

Unable to repro your problem using Unity 2018.2.19f1 and CM 2.2.7. If behaves identically in build and editor, and never gets stuck. I’ve attached this script to the FreeLook to implement the button handling:

using UnityEngine;
using Cinemachine;

public class OrbitIfButton : MonoBehaviour
{
    CinemachineFreeLook freeLook;

    void Start()
    {
        freeLook = GetComponent<CinemachineFreeLook>();
    }

    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            freeLook.m_XAxis.m_InputAxisName = "Horizontal";
            freeLook.m_YAxis.m_InputAxisName = "Vertical";
        }
        else
        {
            freeLook.m_XAxis.m_InputAxisName = "";
            freeLook.m_YAxis.m_InputAxisName = "";

            freeLook.m_XAxis.m_InputAxisValue = 0;
            freeLook.m_YAxis.m_InputAxisValue = 0;
        }
    }
}

Are there any more details you can give about your project? Maybe you could put together a lightweight sample project that demonstrates this?