How to smoothly change the value of a single VirtualCamera?

Hello.

It is possible to have two or more VirtualCamera and change the PRIORITY to have a smooth camera movement.
But is it possible to have a single VirtualCamera for smooth camera direction?
For example, if I change the Fov value to make it zoom, the zoom is completed instantaneously.

When the player enters a certain point, the Fov of the VirtualCamera that follows the player is manipulated,
Is there no other way but to have two VirtualCamera following the Player at all times?

You can change any value smoothly over time with this simple process:

Smoothing movement between any two particular values:

You have currentQuantity and desiredQuantity.

  • only set desiredQuantity
  • the code always moves currentQuantity towards desiredQuantity
  • read currentQuantity for the smoothed value

Works for floats, Vectors, Colors, Quaternions, anything continuous or lerp-able.

The code: SmoothMovement.cs · GitHub

Hello! Mr. Kurt-Dekker.
Thank you for your answer.

It seems that the Cinemachine function itself does not have a smooth value change.
It would have been useful to have the ability to change values smoothly while Blend in one VirtualCamera, but it seems difficult.

I will try to implement it with SmoothDamp as you suggested.

Cinemachine has a LOT of smoothing.

It certainly has position and movement smoothing.

You also mention FOV which is completely different than position.

I don’t know if Cinemachine has smooth FOV changing or not.

I would intuit that it DOES have this but I haven’t played with FOV in Cinemachine, so be sure you look carefully through the API docs before concluding something doesn’t exist.

Whatever values you set in the Cinemachine properties will take effect immediately, as is generally the case in Unity. Nothing special going on there. To change values gradually you can use techniques such as the one @Kurt-Dekker suggested.

For Cinemachine I do recommend doing everything by switching between different VCams rather than manipulating values on the VCams. A trick you could do here would be to have the camera that has a different FOV than the standard camera be a child of the standard camera, with no settings for follow or look at. Then the normal VCam can keep doing the same following and looking, and you can just activate the other FOV camera in order to do interpolation.

The only problem here, which is a fundamental CM problem, is that you now have to double up all your transition settings if you’re not doing ANY CAMERA stuff. There isn’t a good afaik to say “I want all transitions from this set of cameras to that set of cameras to have this one setting”

1 Like