- Home /
Cinemachine 2D - How to reset lookahead
So when I respawn my player on a checkpoint, the camera goes back with the player just fine but it is applying the lookahead option and it makes a snappy camera change when you move the character.
Is there a way to reset the lookahead option when respawning via script?
Or is there any solution to this?
Answer by saporter · Mar 19, 2020 at 04:58 PM
Try OnTargetObjectWarped(). Documentation
Vector3 respawnDelta = GetRespawnDelta();
player.transform.position = player.transform.position + respawnDelta;
VirtualCamera.OnTargetObjectWarped(player.transform.position, respawnDelta);
Omg, thank you! Previously I was update current position to new position for teleportation and it looks bad. After adding to current pos diff to new pos this method start working.
Your answer
![](https://koobas.hobune.stream/wayback/20220612222618im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Cinemachine Confiner 2D shift my camera view 0 Answers
2D Cinemachine with Lookahead time respawn problem 4 Answers
Smooth camera script looking at left hand side of character. 0 Answers
camera problem 0 Answers
Resetting Camera with a key input 1 Answer