Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Camera stutters in a simple rotation?!

Discussion in 'Scripting' started by JanDawid, Mar 5, 2016.

  1. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    Did you finally solve this ?
     
  2. JanDawid

    JanDawid

    Joined:
    Jul 7, 2014
    Posts:
    283
    This is quite an old thread but generally I've found to get smooth rotations if using a Lerp function and including Time.deltaTime in the third parameter like this:

    Vector3.Lerp(Vectot3, Vector3, Time.deltaTime * floatSpeed);

    And I've found this to work best in LateUpdate() for camera movements, especially if following a character so you'd want to wait for other movements that it relies on to be finished for that frame.

    In terms of working with physics-based objects, using Interpolate on the RigidBody components will help a lot.

    However I will note that stuttering can happen regardless when using the Unity Editor, especially if certain windows are open in the Editor. Check your builds for the most consistent results.
     
  3. pistoleta

    pistoleta

    Joined:
    Sep 14, 2017
    Posts:
    539
    I didn't realize your problem was with the camera, my problem is with the shadows stuttering, I wonder if that you mentioned about using rigid bodies might work for me.
    Here is my problem:
    (last post)
    https://forum.unity.com/threads/directional-light-shadows-flickering-issue.672094/
     
  4. robertseegrist

    robertseegrist

    Joined:
    Jan 4, 2016
    Posts:
    9
    Using LTS 2022 and the Input System. Had severe stutter with mouse controlled rotation:
    playerTransform.Rotate(0.0f, lookInput.x * horizontalSensitivity * Time.deltaTime, 0.0f)

    Removing Time.deltaTime fixed the problem.
    playerTransform.Rotate(0.0f, lookInput.x * horizontalSensitivity, 0.0f)