I’ll download the thing and take a look.
edit 1:
In the mixing camera scene the first thing i noticed is that the far threshold is really small and the time is extremely high (10s).
I changed the distance threshold to 10 and the time to 0.5s and it looks fine to me.
In any case I cant really see anything wrong with it in the mixing scene.
I’ll check out the other one now…
edit 2:
The normal scene definitely has some bug.
I will investigate.
edit 3:
When you turn the blend time to something lower it works fine.
The problem appears when another blend gets triggered while the old one is not yet done.
- Far => Close (starts working fine)
- While (1) is still in progress, “Far” gets triggered
- This causes a new blend to start “MidBlend(Far=>Close) => Far”
The solution is straightforward (from a logical perspective at least)
What could happen: Cinemachine keeps the old blend around, evaluates it, and uses it as input for the new blend. Blend-ception style haha.
However I imagine this getting pretty complicated in code. And by pretty complicated I mean making sure this stuff doesn’t generate GC pressure.
edit 4:
Yep, this scenario seems to be best solved using the mixing camera.
Having cinemachine do “cascading blends” would be nice though.
I have an idea how it can be solved perfectly though:
It could be solved by having each blend as a struct.
And then creating something like a “List”.
Where each BlendState has stuff like time, timeRemaining, progress, … and course 2 sources (A and B).
And both A and B can be either a virtual camera (like a root source), or an index into that same list! (so blending between another blend that is still ongoing…)
Things to consider:
-
every time something gets added or removed in the list, all indices of the containing elements have to be updated
-
dealing with a setup like that with a pure List<> will be a huge fucking mess in no time haha.
But creating a custom container “CinemachineBlendContainer” or something like that, would solve it nicely.
You could add more blending by doing “BlendTowards(vCam, time)” and to know where to blend from, it would automatically refer to the last entry in its internal list.
The container would always refer to the currently active virtual camera as a root source to start a blend with BlendTowards().
-
negative: would probably take an hour or two to implement
-
positive: arbitrary blend cascades, one less corner case that users have to think about.
-
the scenario @jdeuce is dealing with should be supported out of the box, so maybe it is worth taking the time.
edit 5:
I was overtinking it a little bit.
You don’t even need to index into the list at all.
All you’d have is a stack of BlendStates.
First one in the stack blends from a vcam to another vcam.
And every BlendState on top, just blends from the previous blendstate (its result), to another vcam. Every frame cinemachine would simply traverse the list downwards, interpolating through and through. No indexing tricks needed. As long as the hypothetical “BlendState” I’m suggesting is a struct everything should be fine (as in not garbage collection pressure).