Search Unity

Resolved FloatingOrigin, Cinemachine and Camera Shakes

Discussion in 'Cinemachine' started by RayanGhosh, Feb 5, 2021.

  1. RayanGhosh

    RayanGhosh

    Joined:
    Oct 21, 2017
    Posts:
    7
    Hello everyone!

    I tried using floating origin script with a basic cinemachine setup

    - Attached the FloatingOrigin.cs to main camera.
    - Main Camera with a CinemachineBrain and a GameObject with a virtualCamera Component made to follow and aim at the player.
    - Virtual Camera has a Transposer component and a Composer component



    By this mere setup, Floating Origin does function just fine and also does the Cinemachine (No Doubt) However it is the interpolation performed by the cinemachine on following a target gives jittery and glitchy visuals while resetting transforms over threshold.

    By Reducing Damping to 0 on Virtual Camera's Transposer, gave the desired result. (Which is no jitter and smooth transition - the perfect illusion promised by the floating origin script.)

    I tried several attempts to achieve the desired result with Damping on by adjusting
    - RigidBody's Interpolation
    - CinemachineBrain's Update Method and Blending Update method
    - Transposer Damping
    - Script's Update

    Had failed So Far...
    I don't know if the community has any solutions? or is it how it is - cant be resolved.
    I would be very glad to learn.
     
    Last edited: Feb 7, 2021
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    RayanGhosh likes this.
  3. RayanGhosh

    RayanGhosh

    Joined:
    Oct 21, 2017
    Posts:
    7
    This works Just fine!
    vcam.OnTargetObjectWarped made all the difference, Many Thanks, Gregoryl.
     
    FlightOfOne and Gregoryl like this.
  4. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    Hi
    Hello,

    Once you apply this, does it get set right away or after few frames? I am trying to do the same thing and it mostly works but every so often it jumps or so jumps (like in the video of this thread). As mentioned here, if I set the damping to 0 it works fine. Any advice would be appreciated, thanks!

    upload_2022-2-11_13-56-28.png

    Here is a video of what happens. It almost looks like, some times it doesn't listen to that method call. Note that I have it set to reset at every 10 units, for testing purposes. It does happen at larger distances too. Also, ignore the last bit where it spins around.
     
    Last edited: Feb 11, 2022
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    This should not take a few frames. If you call OnTargetObjectWarped() at the same time as when you move the target, it should take effect immediately.

    What version of CM are you testing with?
     
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,434
    using update method: lateupdate in the CM brain helped for that in one project.
    (otherwise there was clearly 1 frame delay or so)
     
    FlightOfOne likes this.
  7. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    Hi, I am on 2.6.11. However, it seems something else might be causing this stutter, it is just super imposed with cinemachine's damping. I will be digging more into this in the next few weeks and will share if I find anything new. Thanks.
     
    Gregoryl likes this.