Jerky Camera

Hey guys,

Me and some other guys are doing a one month project in Unity. We’re creating a game with a snail which can walk on slopes ( yup its funny ). We’ve solved most of our problems one way or another but one seems to be common and we cant get past it. It is - The jerky/jumpy camera when moving the CharacterController on slopes.

We started by writing our own camera code but it had the same issue. After some trouble shooting we went to the easy solution of using the SmoothFollow and SmootLookat in the standard package. This has not eliminated our problem.

Does anyone have a similar problem ?? And perhaps a solution ?? Or is a generel problem in Unity or just games in generel … ( it can be recreated in other Unity games like Velociraptor Safari )

Thx for your assistance :slight_smile:

Michael

I’ve had some issues with jerky cameras in the past, most times the reason was that my movement code was in the same type of update function that my camera follow code.

Try moving the camera follow to LateUpdate or your movement code to Update, you could also try FixedUpdate.

Doing the above has fixed my problems most of the time.

Well - we’ve tried that actually. The SmoothFollow script in the pro standard assets package is in the LateUpdate. Problem persisted.

The problem seems to be rounding errors - We’ve thought about doing a

if(Mathf.Abs(old_pos - new_pos) < round_error){
** skip **
}
else{
** standard code **
}

But it seems to be a generel problem in the Slerp / Lerp functions that it keeps rectifying the position - and with a relatively close camera and high speed it becomes jerky.

If anyone else has a fix for it let me know :slight_smile:

Thx in advance - Michael

Try FixedUpdate.

–Eric

i have the same problem, high speed rigidbody with close camera. it jitters enough to give you seizures =)

i have tried everything:
-rigidbody interpolation
-cam update during fixedupdate
-triggering cam update inside the player fixedupdate
-cam update during LateUpdate
-adjusting world scale

LateUpdate stops jittering when the distance to the player is locked, but when i add Lerp or SmoothDamp or anything it jitters like crazy again.

same with FixedUpdate: it stops the jittering when the distance to the player is fixed, but the camera seems to be one physics step behind the player… (the faster the player goes the farther the distance from the camera)

this is really boggling my mind because this behaviour doesnt seem to match with the way Unity should be updating

btw i am on unity iphone, fixed timestep of 0.03

=/

I’m on the same boat, although it’s not too bad that I can’t use the script. However, I would like an explanation as to why this happens if anyone knows the cause.