- Home /
Character and Camera motion smooth in Editor, but jitters in Build
My team and I have been struggling to get smooth character and camera motion in builds (in editor everything is smooth as butter). Once you start playing the game in a build, the character appears very jittery and the camera acts like it is getting hung up and second or so (this is less noticeable at higher framerates, but makes the game near unplayable at lower framerates of 40 or lower). We are using 5.6.3f1 and so far have tried every option possible as far as what we've come across on Unity Asks and the forums. Our characters use root motion and have rigidbodies, the camera of course does not.
Thus far we have tried:
Putting the camera in FixedUpdate, Update, and LateUpdate.
Trying tons of different methods to lerp the camera position and rotation to make it smooth.
Tried all update modes on the character's animator Normal,
AnimatePhysics, and Unscaled Time.Tried having Interpolate on, off, and Exterpolate.
Adjusting physics manager settings, including Default Contact Offset,
Sleep Threshold, Default Solver
Iterations, and Default Solver
Velocity Iterations.Lowering Time Scale in editor to try to reproduce the jitter in-editor,
doing so does not reproduce jitter.Capping framerate to 40, 30, 20, and 10 in editor, doing so also does not reproduce jitter.
I think it is reasonable to assume that SOMETHING, some setting is getting changed in the build. Is this an actual Unity bug, or does anyone else have a similar problem or idea as to what is going on?
$$anonymous$$y advice would be to deal with each (character and camera) problem separately.
Does the character still jitter with no special camera (just a regular static camera)?
Does the camera keep hanging when tracking an object that is confirmed to move smoothly (e.g. a default cube moved with transform.translate)?
Also try:
Removing the rigidbody and collider, and anything physics related from the player and seeing if its still jittery (it should still be able to move with root motion).
Long shot, but the character's rigidbody doesn't happen to be a child of another rigidbody by any chance? I had endless problems getting smooth motion in a set up like that.
Answer by Disco_Doctor · Nov 19, 2021 at 08:10 PM
The root problem lies in the fact that the camera is not a Rigidbody. Basically whats happening is that the camera is not moving in sync with the rigidbody (one moves with unity's engine and the other within unity's physics engine). Simply make the camera a kinematic rigidbody, then apply rotations using rigidbody methods. Of course don't forget to mark it: interpolated (or not if your player isnt although recommended).
Your answer
Follow this Question
Related Questions
How to prevent camera jitter when moving my Rigidbody first person controller 4 Answers
How does the Animator drive Rigidbody with root motion (in detail)? 1 Answer
Animators deltaPosition is (0,0,0) when using override layers above root motion animation 2 Answers
Can't make my character to jump ?? 0 Answers
Rotate camera diagonally over object 0 Answers