Virtual Camera Slowly follow behind Fast moving player

I am trying to make a specific camera behavior and cannot figure it out.

I have a player with a dash/warping ability and I want the camera to instead of perfectly follow the player during this (which is really abrupt) I want it to slowly rotate to keep looking at the player and to slowly move to where the camera normally would be. Sort of a dolly/pan behavior.

I could write my own camera controller scripts that does this but cinemachine is fairly easy to get set up and everything just works, but I can’t figure this out. I have tried:

  1. messing with the damping on my normal camera, but that isn’t very intuitive and isn’t really getting at what I want.

  2. setting up some other virtual camera with a different behavior and blending between them, but I am not really sure which type of virtual camera I would need for this sort of behavior.

Thanks in advance

If I understand correctly, you’re looking for OnTargetObjectWarped(). Pass it the change in position of the character being warped - the same change will be applied to any vcams tracking that character.

https://docs.unity3d.com/Packages/com.unity.cinemachine@2.8/api/Cinemachine.CinemachineCore.html#Cinemachine_CinemachineCore_OnTargetObjectWarped_Transform_Vector3_

Thanks for the advice. While this is a good thing to know about and I might use this in the future, I do not think it is quite what I am looking for.

I do not know if I am quite happy with the result, but below is a clip of what I have which is pretty much what I want. A better way to describe what I want might be to say I want the camera to swing around the player when they dash so there is a feeling of inertia and movement. It also creates a more smooth transition. I did this by having another camera set up almost the same but with higher damping values. When the player dashes I slerp the follow body towards the movement direction which creates a swing effect. If you have a more built in solution I am all ears.

I think the problem with the OnTargetWarped() is that my player isn’t actually warping but rather lerping to a new position very quickly.

A possible alternative solution would be to have a custom script on the vcam that modifies the damping as a function of character speed: when the character accelerates suddenly, bump up the damping, then lerp it back down to normal as the character slows down.

What version of CM are you using? There were some recent changes that affect the damping of 3rdPersonFollow.

That sounds like a pretty solid idea.

I am using CM 2.6.3

You should upgrade CM

Ok, do you currently recommend 2.8.0?

yes

Awesome, thanks for your help!

@Gregoryl I saw your post about Core.OnTargetObjectWarped and have a similar case. I have a Follow object and only a FramingTransposer to make a 3rd person follow cam. I’m very happy with it. However I’m trying to warp the follow object and cannot seem to avoid crazy rubberbanding of the camera. When should I call that function? After the warp, on the same frame? Wait a frame? Before? It doesn’t appear to be doing anything.

Thanks.

EDIT: From reading other posts, I realized that disable/enable the vcam will warp it. This does work. I still don’t understand this API call, but all good. :slight_smile:

You should warp the target and call OnTargetObjectWrped on the same frame. If you do that correctly, you should not need to disable/enable the vcam.