I have a main game camera using Target Groups and it works awesome (thanks Cinemachine!) I’m doing a lot of adding/removing target groups during gameplay.
However, I’m trying to add another type of camera controller that does face tracking and some camera movement based on that. Just adding this face tracking controller to the main game camera does nothing, since I assume Cinemachine virtual camera is 100% controlling everything.
Is there some way to “layer” these camera controls – Cinemachine does the main work and the other controller layers on top of it?
I tried making a second virtual camera set to “Do Nothing”, hoping this would work with the face tracking and then could use a mixing camera to combine the two but any kind of Cinemachine virtual camera totally overrides this face tracking camera controller?
(*please note, this is a proprietary face tracking controller, so using a different one is not an option)
I am not sure how your face tracking controller works, but if it modifies the second virtual camera’s properties, then that should work.
Could you share more information?
Could you send an image of your Hierarchy setup? Showing Main Camera (Unity Camera) and Cinemachine Virtual Cameras.
1 Like
If you want to post-process CM’s output, you can do that. After CM positions the camera and sets the lens properties, it issues an event: CinemachineCore.CameraUpdatedEvent. You can hook into this event and run your face tracking code from there. At this point in the frame, you’re free to modify the main Camera’s transform and lens because CM has already done its thing.
Thank you, that is very helpful!
1 Like
Another option is to let CM drive the Camera’s parent object by putting the CMBrain there instead of on the Camera. That way, if you have another script that needs to drive the Camera directly, it can do that (provided that its execution order comes after CinemachineBrain, or you have the Brain in Manual Update mode). This is the strategy, for example, for combining CM and VR.
1 Like