Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

CM v2.1 Release Candidate

Discussion in 'Cinemachine' started by Adam_Myhill, Sep 24, 2017.

  1. marcpeyre

    marcpeyre

    Joined:
    Jan 23, 2014
    Posts:
    15
    I've just updated Cinemachine from 2.0.1 to 2.1.09 and I've noticed a change that breaks our custom cinemachine components. Could you clarify why you've decided to only update the VirtualCamera's position/rotation if a Follow/LookAt target is specified?

    [CinemachineVirtualCamera.cs]
    Code (CSharp):
    1.  
    2. override public void UpdateCameraState(Vector3 worldUp, float deltaTime)
    3. {
    4.         ...
    5.         // Push the raw position back to the game object's transform, so it
    6.         // moves along with the camera.
    7.         if (!UserIsDragging)
    8.         {
    9.             if (Follow != null)
    10.                 transform.position = State.RawPosition;
    11.             if (LookAt != null)
    12.                 transform.rotation = State.RawOrientation;
    13.         }
    14.         ...
    15. }
    How would we implement a camera behaviour that doesn't rely on a Follow or LookAt target, for example a free roam camera with a movement and aim behaviour by adding delta axis input?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,623
    @marcpeyre The idea is to be able to place a vcam without a follow target and expect it to stay there, even if some camera behaviours cause the camera to momentarily prefer another spot. Imagine you had a cameraman and told him to "stand here", but he gets distracted for a moment and steps away. Pushing the momentary position back to the transform will make him forget his original spot.

    If you want to control the vcam's position manually, then set its Aim and Body to "Do nothing" then move the transform around yourself. In what way were you depending on the old behaviour?
     
  3. marcpeyre

    marcpeyre

    Joined:
    Jan 23, 2014
    Posts:
    15
    I was setting the RawPosition and RawOrientation without a Follow and LookAt target, which would work in version 2.0.1, but I now see that that was a wrong approach. I'll try controlling the VirtualCamera's transform through script directly instead of through its Cinemachine components. Thanks for the reply!