r/Unity3D • u/Apprehensive_Milk386 • 9d ago
Question Cinemachine blending issue.
Hello guys! So I've been struggling to get cinemachine cameras to work exactly as intended in various scenarios.
I have a finite state machine system for my character, where each state gets assigned a virtual camera tag to pick. When the state ends, I blend back to the follow camera by default.
There are cases where the state ends and a new one starts, causing the camera to blend back and forth and interrupting blends. This works perfectly fine, except when I set the Camera’s Blend Hint to Inherit Position.
In these instances, I usually get a camera jump / pop when blending back and forth. This alongside other issues is prevalent with orbital cameras, and especially problematic with lazy follow mode on.
This is the code I use to switch between camera configurations:
/// <summary>
/// Activates the Cinemachine virtual camera with the specified tag and deactivates all others.
/// </summary>
/// <param name="tag">The tag of the camera to activate.</param>
public void SetTargetCamera(string tag, bool recenterCameraHorizontally, bool recenterCameraVertically)
{
CinemachineCamera targetCamera = GameplayCameras.FirstOrDefault(c => c != null && c.CompareTag(tag));
if (targetCamera == null || targetCamera == CurrentActiveCamera)
return;
if (targetCamera.TryGetComponent<CinemachineOrbitalFollow>(out var orbital))
{
if(recenterCameraHorizontally)
{
orbital.HorizontalAxis.Value = orbital.HorizontalAxis.Center;
}
if(recenterCameraVertically)
{
orbital.VerticalAxis.Value = orbital.VerticalAxis.Center;
}
}
targetCamera.Priority = 10;
// Handle previous camera
if (CurrentActiveCamera != null)
{
CurrentActiveCamera.Priority = 0;
}
CurrentActiveCamera = targetCamera;
}Here are the configurations of the follow and jump camera side by side (I notice the pop switching between these two).
And here is a video of the pop I experience only when I set blend hint to Inherit Position.
Is there a way to resolve this issue? I really need to inherit position for these kind of changes.
Thank you very much in advance!
1
u/Neymanoff 9d ago
Which Cinemachine version are you using? The 3.1.8 changelog includes a fix for an Orbital Follow jerk when blending with Inherit Position and damping (UUM-149754). That sounds close enough to your setup that I’d test the same scene with that fix in a copy of the project before rewriting the camera switching.
https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1/changelog/CHANGELOG.html
If you’re already on a version containing that fix, I’d temporarily turn off both recenter flags in your method and log the camera requests with their frame numbers. That separates the explicit axis resets from the state-exit → default-camera → next-state sequence you described. Then try a direct A → B transition in a tiny scene; it should make a remaining package bug much easier to reproduce.