Hello, I am looking to implement a button that will recenter the Cinemachine camera behind the player character. I have a camera controller script that runs the following function on a CinemachineOrbitalFollow component’s axes
I’m using Cinemachine 3.1.2
private void RecenterAxis(InputAxis axis)
{
var recentering = axis.Recentering;
recentering.Enabled = true;
recentering.Wait = 0;
recentering.Time = span;
axis.Recentering = recentering;
//axis.Recentering.Time = span;
//axis.Recentering.Wait = 0;
//axis.Recentering.Enabled = true;
Debug.Log("Recentered.....");
}
I have tried several permutations of the above code, creating a new instance of the Recentering struct and setting it, setting the items individually but none of the changes seem to take effect. I’ve also tried setting these values and calling “TriggerRecentering” On the axis. I’ve also cut down from doing all 3 axes at once to a single axis, but none of these has worked.
If I manually enable/disable the recentering from the inspector, things work as expected and the camera recenters nicely, but if I try to trigger the change from this script then nothing happens. I do see the “Recentered” message in the debug log as well so I know the code is being run.
I marked this as a bug since it seems like there is something not quite aligning with what the expectations are for these functions, but it could also be user error. Any help or guidance on how to get this working would be greatly appreciated. Please let me know if I can supply any more information. Thanks!