Search Unity

Question Transition blending for a TargetGroup you're dynamically changing the contents of.

Discussion in 'Cinemachine' started by mikeomni, Apr 26, 2022.

  1. mikeomni

    mikeomni

    Joined:
    Aug 23, 2015
    Posts:
    5
    Has anyone ever come across a way to set a transition blend on a TargetGroup when using AddMember() and RemoveMember() to dynamically change the contents of the TargetGroup? You can easily set custom blends when changing priorities between VCams, but because the vcam priority isn't changing, (we're just removing enemies as they die from the combat cam's TargetGroup) but there is no blend behavior I can find for when the targetgroups contents change and so it just snaps jarringly to the new framing targets without a blend.

    I've been trying to come up with a solution with a bunch of researching and experimentation already for a while now, and would really like to avoid the (imo) ugly solution of having to manage two separate vcams filling the same role and having to revolving door them every time we change the contents of the targetGroup in combat, which will be very, very often. And we can't just leave the dead enemies in the group until they're all spent and release the vcam, as the remaining enemies can chase you away from the place the dead enemies fell, stretching the group framing out to absurdity.

    Thanks for any help, this is kind of my longshot last ask failing to find any good solution to this.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    Instead of simply adding and removing enemies from the group, lerp their weight to/from 0 over the course of a few frames, then add/remove them. Adding or removing group members of weight 0 will not disturb the camera.
     
    mikeomni likes this.
  3. mikeomni

    mikeomni

    Joined:
    Aug 23, 2015
    Posts:
    5
    I could kiss you for that Gregory- that's a brilliant, creative solution. That must've been the only thing I didn't think to try doing along the way. Thanks very much for that reply!
     
    Gregoryl likes this.