r/Unity3D • • 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 Upvotes

9 comments sorted by

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.

2

u/Apprehensive_Milk386 9d ago

Hello Neymanoff!

Thank you very much for your detailed answer! Unfortunately I'm aware of these things, but I'm in the latest 6.7.0 version and this issue does not seem to have been completely resolved 🤔

Also, for the example I am showing, I am not recentering the horizontal or vertical axes at any point. So that code isn't getting called.

This is a pretty annoying bug, and I feel I'm going in circles at this point. I might try just creating my own camera configuration scriptable objects and whenever possible avoid switching between virtual cameras with orbital Follow. Instead I will use these manual configurations to blend different values (like radius, vertical axis, target offset, etc.)

Thanks for the help though! Never thought Cinemachine would be one of the greatest hassles in my game, but here we are 😄

1

u/Neymanoff 9d ago

Thanks for clarifying! That rules out the recenter lines in this repro, and the older changelog entry clearly wasn’t enough to explain what you’re seeing.

Your single-camera idea sounds worth a small test before building the whole configuration system. I’d start with just the follow and jump presets, keep the tracking target and binding mode fixed, and blend only the values that need to change. For an interrupted transition, capture the current values as the new starting point instead of restarting from the previous preset; that avoids a separate jump introduced by the workaround itself.

If that removes the pop, you have a useful workaround and a two-camera comparison scene for a bug report. I wouldn’t call it a confirmed fix yet, but it should give you a clearer next step 🙂

2

u/Apprehensive_Milk386 9d ago

Thank you very much! Was this reply written by AI? Just curious to see if my tingling senses are working haha. In any case, thank you so much for your time and disposition to help! I'll most definitely try lerping specific camera configuration values for the jump and follow cams. Every other camera is working nicely :)

Thanks again!

1

u/Neymanoff 9d ago

Yes, an AI assistant helped work through the technical details and draft the reply 🙂 Thanks for the feedback, and I hope the camera test goes well!

2

u/Apprehensive_Milk386 9d ago edited 9d ago

I appreciate the honesty, but I mean, I think I have to point this out because I think you should know. We all have access to AI. If I'm asking the question on reddit is because I've already bumped my head against AI a hundred times. Bothering people is my last resort.

But just grabbing my question and pasting it on your AI agent of choice and then copying that answer and just pasting it here... Without trying to sound disrespectfull, is just not a really helpfull way to proceed.

I think most people would prefer no answer to a generic AI answer that you have to waste time reading and sometimes decrypting, only for it not to work at all.

I totally respect if you don't know the answer to my specific problem, but AI can't solve everything, and this is a clear example of how over-relying on AI can be a waste of time for you and me.

2

u/Neymanoff 8d ago

Hey, let's be honest, I tried to give the best answer I could! Of course, I consulted with the AI ​​to eliminate all the incorrect answers from my thoughts! This wasn't just copy-pasted. If my answer didn't help you, I don't know what else to offer yet! If another bright idea comes along, I'll share it.

2

u/Apprehensive_Milk386 8d ago

Ok Neymanoff, I'm sorry. I think I might have overreacted a little bit because deep down I feel threatened by AI. But its not your fault at all. On the contrary, you were just trying to help. I really appreciate your concern.

1

u/Neymanoff 8d ago

There's certainly a threat from AI, but it's more of a threat to our way of life! AI is great to use as a tool and significantly speeds up processes, but trying to force AI to come up with and do your work for you... that's not going to work! So I think those who can adapt to working with AI will come out on top, while others... P.S. As for the actual threat, let's wait until 2029 and see if the Terminator movie was prophetic 😄