Search Unity

Bug Framing Transposer starting position is offset from Target Group

Discussion in 'Cinemachine' started by NashBits, Sep 21, 2022.

  1. NashBits

    NashBits

    Joined:
    Dec 10, 2013
    Posts:
    9
    I have a virtual camera with a Framing Transposer body following a Target Group (orthographic, 2D game, no LookAt). In editor mode and during gameplay, the camera frames my target group perfectly.

    But when I first press start, it seems the virtual camera jumps to a position that includes world position (0,0) as one of the targets. The Target Group itself remains correctly positioned, but the yellow group gizmo on the vcam stretches to include (0,0) on the first frame, and the camera's position is offset as if it was including (0,0) for the target group framing.

    On the next frame, the yellow gizmo seems to correct itself, but by then the vcam is using its damping settings to move from the wrong position to the new correct position. Of course, the desired behavior is for the camera to start correctly framed. I have "center on activate" checked, and I've experimented with all the Body settings and Target Group settings.

    I apologize if this is due to something I've missed and not a bug.


    First frame (pause + play) - all 3 target objects are at y 100, but the box is expanded to include 0,0
    Screen Shot 2022-09-21 at 12.50.42 PM.png

    Final correct framing:
    Screen Shot 2022-09-21 at 12.51.09 PM.png


    EDIT: I can easily get around this with a little coroutine on start that turns the vcam off, waits a frame, and then activates the vcam again. Seems like the (0,0) inclusion is for literally just the first frame of the game. But ideally, no code would be required for this behavior.
     
    Last edited: Sep 21, 2022
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    This might be due to a setting in your Target Group. Can you show its inspector?
     
  3. NashBits

    NashBits

    Joined:
    Dec 10, 2013
    Posts:
    9
    Sure thing

    Screen Shot 2022-09-21 at 6.49.30 PM.png
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    Try changing the Group's Update method to FixedUpdate, since your camera is running on FixedUpdate (you can see that next to the Solo button in the inspector).
     
  5. NashBits

    NashBits

    Joined:
    Dec 10, 2013
    Posts:
    9
    Sorry for the delay, but you're right, this seems to have worked! Thanks so much.
     
    Gregoryl likes this.