Player teleports - lerp camera to new position?

Hello CM Team!

I’m making a 2D game where the player can teleport short distances in the level. I have a Cinemachine Virtual Camera which follows the player around. When the player teleports, the camera joins him instantly and the effect is a bit jarring. Is it possible to do a smoother movement of the camera to the new position? Like a lerp.

Any help appreciated.

I have tried adding a call to OnTargetObjectWarped() to my code, but I’m not sure what this does. It doesn’t seem to have helped me.

OnTargetObjectWarped() make the camera warp instantly, bypassing damping. If instead you just warp the player without calling OnTargetObjectWarped() then the camera will think the player just moved a lot, and will go to the new position with damping. This will be smooth if your damping setting is > 0.

1 Like

Thanks, great tip. I took out OnTargetObjectWarped() and increased the damping and it’s smoother now. Checking the box for Unlimited Soft Zone also seemed to help, for reasons that are beyond me.

1 Like