Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Cinemachine Freelook + Playmaker = Jittering

Discussion in 'Cinemachine' started by OZBEND, Jun 21, 2023.

  1. OZBEND

    OZBEND

    Joined:
    Jul 25, 2016
    Posts:
    23
    I'm using Playmaker. When I move the character (using Riggidbody and Smooth Look At Direction action) and the camera sideways at the same time, there is jittering. Forward/backward is ok. No such problem when using the Character Controller. When using the standard camera is also all fine. I understand that this is not your product, but maybe you can advise something. I have changed the update methods to Fixed etc'. It only helps for forward/backward movement.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,207
    There are many possible kinds of jittering, and many possible causes. A common one when using Rigidbodies is inconsistency when moving or rotating. Using the wrong API or doing it from the wrong place can interfere with the physics simulation and cause jitter.

    It's possible that jitter is always happening, but it's less noticeable when moving forward/back.

    Can you please paste here images of:
    • The inspector for the CM Brain
    • Inspector of the vcam or freelook in question - ideally in play mode while the character is moving
    • The scene hierarchy, showing the main camera, the vcma or freelook, and the target character (I need to see the relationship between them)
    • The inspector of the character's Rigidbody
     
  3. OZBEND

    OZBEND

    Joined:
    Jul 25, 2016
    Posts:
    23
    Here is everything you asked for:
     

    Attached Files:

    • S-1.png
      S-1.png
      File size:
      20.8 KB
      Views:
      30
    • S-2.png
      S-2.png
      File size:
      60.5 KB
      Views:
      31
    • S-3.png
      S-3.png
      File size:
      8 KB
      Views:
      29
    • S-4.png
      S-4.png
      File size:
      54 KB
      Views:
      30
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,207
    Thanks. A video of the jitter would be helpful too.

    For now, can you try this diagnostic experiment?
    1. Put the Brain in SmartUpdate/LateUpdate (reset it to its default settings)
    2. Enter Play mode
    3. Move the player so that it's jittering
    4. While this is happening look at the freeLook inspector. At the top, to the right of the Solo button, it will say FixedUpdate or LateUpdate, depending on how the player is being tracked. What does it say?
     
  5. OZBEND

    OZBEND

    Joined:
    Jul 25, 2016
    Posts:
    23
    Here is it:
     

    Attached Files:

  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,207
    Thanks for that. It means that the player is being moved on the render clock (i.e. in Update or LateUpdate). This is not generally compatible with Rigidbodies, which need to move on the physics clock (i.e. FixedUpdate).

    Why do you have a Rigidbody on the player? Can you remove it?
     
  7. OZBEND

    OZBEND

    Joined:
    Jul 25, 2016
    Posts:
    23
    I use the Riggidbody because my character is horizontal (animal). I can't use the character controller (there is no jittering when using it) because its collider is vertical. In general, I can't find a solution
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,207
    You can still use a horizontal collider and remove the rigidbody.
     
  9. OZBEND

    OZBEND

    Joined:
    Jul 25, 2016
    Posts:
    23
    How? The Character Controller has its own capsule and can't be replaced.
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,207
    You'll have to make your own character controller that uses your desired shape. There are many tutorials on youtube for this. I did a quick search and this is the first one that pooped up (I haven't watched it, but I trust that it will at least point you in the right direction):

     
  11. OZBEND

    OZBEND

    Joined:
    Jul 25, 2016
    Posts:
    23
    I'm using Playmaker
     
  12. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,207
    I don't know playmaker. You'll have to do some hunting for relevant tutorials. Or don't use playmaker for this.
     
  13. OZBEND

    OZBEND

    Joined:
    Jul 25, 2016
    Posts:
    23
    In general, there is no solution. Unity's developers don't want to add the ability to change the type of collider of Character Controller for more than ten years (I found very old posts on the subject)
    Thanks for your help
     
  14. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,207
    That's a little exaggerated. It just means that you'll have to do it a different way.