#Camera following entity is jittering with Smoothing/Lerp

1 messages · Page 1 of 1 (latest)

eager geode
#

Hi, I've been trying to make a 3rd person camera for my car game. I used this same principle in the non ECS version and it worked great, but when I started transferring this project into ECS, the camera was jittering. I have figured out it's the smoothing in this very simplified version of the camera controller (I used Vector3.Lerp for the camera position smoothing), and when I don't smooth it's position like that, just follow the car, it doesn't jitter. I'm new to Unity Entities and I would appreciate if anyone knows a solution to this problem.

pulsar jolt
#

also, in what update did you smooth the camera before and where do you smooth it now?

#

and where did you put the update of the car itself (that the camera is following)

eager geode
#

Well, I'm using the new Unity Vehicles 0.1.1-exp.1 for this. It seems to me that its running in a fixed step count. I'm using LateUpdate for both the old and new camera, so technically its the last thing to update in the frame.

pulsar jolt
#

yeah that seems reasonable

#

my first theory is your framerate is much higher than your physics timestep, and you have a high lerp factor

#

which will cause jittering because it will lerp a big amount after the fixed update, then have a couple of frames with a small amount of lerp

#

you may want to adapt your smoothing to the velocity of the thing you follow

#

e.g. use some kind of interpolation/extrapolation instead of a lerp

#

or a combination of interpolation and lerp

#

for example if you do proper interpolation of your car's position in the regular update and follow that instead of the raw physics position, it should already be much smoother (unless im completely wrong of course)

eager geode
#

Thanks, I'll definitely be giving that a try later today

pulsar jolt
#

I also recommend to use damping instead of lerp as I mentioned initially

eager geode
#

It could work better, yeah, but I'm currently trying just to port the old camera from the old project because it worked really good with smoothing