I’m using the Cinemachine Target Group component to create a combat camera that targets all enemies in range (as well as the player).
As enemies move, they’ll enter/exit the combat range, so I modify the Target list in Cinemachine Target Group in real time. Main issue is, when adding or removing targets, there’s a strong cut when the camera readjusts its lookat target.
I had the same issue, to fix it I ended up by calculating the center points and the radius of all the enemies.
Then I used a lerp on a gameobject to calculate the “smoothed” position. this same object is attached to the target group. And then via code I change it’s radius with a lerp on it. (Dunno if it’s clear)
Indeed, I was suggesting to have an external Game object that does that! If you touch the CinemachineTargetGroup, it’s freaking out!
This is what I have:
It’s probably the lack of sleep, but I still can’t get it to work properly. I’ve got an “empty” gameobject with just the Cinemachine Taget Group. The script only has the modifications I’ve shown earlier to the Update function. The combat camera (Cinemachine Free Look) has the Player as Follow and the new ‘TargetGroup gameobject’ as LookAt.
Still getting the crazy jitter. Could you perhaps share your modifications to CinemachineTargetGroup.cs?
Ok, I think I get what you did. Instead of having an additional target per enemy, you are merging all enemy positions in a virtual target (gameobject). The issue with that is that if I want to add more weight to one of the enemies, I can’t do it, so the camera ends up looking to the empty space in the middle of all enemies. I could add a custom weight to that virtual position 'tho… I’ll keep investigating.
no as you are making your own “Merging”, you can define your the weight of each enemy,
this is untested pseudo-code so you get the idea (I’m not in front of my computer)
Yeah, that’s exactly what I did. It could be interesting if the Cinemachine dev could add native smoothing and support for dynamic targets, I’m sure other devs would appreciate it.
I have the same issue and I lerp the weights from zero but as soon as the weight is a little bit more than zero the camera jerks a lot and then eases the targets in.
I have hardlocked the camera to a point and I’m using Group composer to for the aim part.
I also have this issue and it seems to me to be a bug in the target group. I have created a thread explaining it here https://discussions.unity.com/t/730538