UnityTechnologies / open-project-1

Unity Open Project #1: Chop Chop
http://unity.com/open-projects
Apache License 2.0
5.74k stars 2.03k forks source link

Camera lerps into place at the beginning of a scene #340

Closed ciro-unity closed 3 years ago

ciro-unity commented 3 years ago

Short description The Cinemachine Vcam lerps into place when a scene is loaded.

Expected behaviour While a small camera movement is ok, it needs to be intentional. As it is now, it's a bug that depends on the camera position at load time.

To Reproduce Steps to reproduce the behavior:

  1. Open the Beach scene. Press play.
  2. Observe the camera moves a bit on entering play.
  3. Turn around and enter the cave with the collider taking to the Glade. The level will load.
  4. Observe the camera is pulled fast into place when the level loads.

Notes

https://user-images.githubusercontent.com/20049224/106399291-0de47200-6418-11eb-9cc0-e66cf3e87877.mp4

sergio-nnz commented 3 years ago

Hi, I would like to fix this bug!

ciro-unity commented 3 years ago

Feel free to give it a shot, @sergio-nnz! We don't "assign" tasks, but rather evaluate work that is done on them and pull it in if it solves the issue.

If you have a clear idea on how to fix it you can move forward and open a PR, or use this issue for comments, or if you want to bring the discussion to the forums feel free to do so by opening a new thread there.

vjs22334 commented 3 years ago

I think I have a fix. warping the vcam to the player after setting the target seems to work.

public void SetupProtagonistVirtualCamera(Transform target)
{
  freeLookVCam.Follow = target;
  freeLookVCam.LookAt = target;
  freeLookVCam.OnTargetObjectWarped(target,target.position-freeLookVCam.transform.position);
}

https://user-images.githubusercontent.com/30682201/106930528-a8f08b00-673b-11eb-817e-444cb1ef7476.mp4

I guess the distance can be adjusted a bit to warp the camera to a set distance away from the player.

Should I make a PR