Search Unity

Follow Object Problem (Out of sync)

Discussion in 'Cinemachine' started by dimitur_kolev2, Jun 21, 2022.

  1. dimitur_kolev2

    dimitur_kolev2

    Joined:
    Nov 2, 2015
    Posts:
    19
    I am using a proxy object that follows the character and that object is the lookat and follow target of the CinemachineFreeLook camera. I tried updating the proxy in fixedupdate update and lateupdate and it doesnt seem to be in sync with the Cinemachine brain.Can I make it so the proxy object uses the Smart Update the cinemachine brain uses? The issue is further amplified because I am using an active ragdoll character and everything must be done in fixedupdate.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    Cinemachine's SmartUpdate works by tracking when the target's transform gets modified. If it is modified only in FixedUpdate, then the vcams tracking it will update in FixedUpdate.

    The question is: how does the target that your proxy is tracking modify its transform? If it gets modified only in FixedUpdate, then your proxy should do the same. If, on the other hand, your actual target has Interpolation on and is moved in a compatible manner, the physics module will patch things so that the transform is modified exclusively in Update, making it compatible with other behaviours that work in Update. If this is the case, then your proxy should update in Update. This is the preferred way to work in Unity, and it will give the smoothest results.

    If your target gets its transform modified in both FixedUpdate and Update, then you're out of luck - it's unlikely that you will be able to sync anything to it satisfactorily. You should fix it if that's the case.

    A good way to find out how your actual target (not the proxy) is updating is to use it as a direct target for a vcam. Then, put the CMBrain in SmartUpdate mode, play the scene, make that vcam live, and look at its inspector. If it says FixedUpdate, then you know that the target is moving exclusively in FixedUpdate, In any other situation it will say LateUpdate.

     
  3. dimitur_kolev2

    dimitur_kolev2

    Joined:
    Nov 2, 2015
    Posts:
    19
    I managed to fix it, made the proxy update position in fixedupdate set the brain to fixedupdate and the most important change - I bought a better animation pack(This was the main problem lol).
     
    Gregoryl likes this.