# Better smoothing algorithm for networked cars?

So, I’m working on a rather important part of my game which is the dead reckoning, and the biggest problem I have is just trying to get a smooth trajectory on the network cars.

The smoothing algorithm I currently use is the catmull between 4 points, dropped by the received car location from the network. (see picture)

Since the points drop closer together at lower speeds, the time-based delta (sweep) also slows down the movement, creating a sort of spring-like effect.

What I really need is more of a damped spring effect, or something that would at least look a little more professionally done. I know there must be something out there that all the top racing games are using…

The way it is now, is the cars seem to bob around back and forth smoothly, but in kind of a bad way.

When I loosen up the following speed, the cars do track nicely, but they fly forward and bounce around if the player slams on the brakes. I also have the problem when the player slams on the brakes for a corner and the network car flys forward and springs back smashing into the other players. This looks even worse than setting the algorithm to tight settings.

What do you guys think?

Should I try rigging a PhysX spring to see if that can absorb the network static better? Or is there any special techniques I’m missing?

Ok, I finally discovered by myself what the real trick to doing this the right way is.

For smoothness, the key is only setting the velocity and torque velocity to the car rigidbody.

Find out how far away the car is from the not-so-smooth vector (catmull-smoothed and projected), and apply catch-up velocity to keep the car in the right spot.

If this fails, (which it rarely does), set the car position to the received position if the car is 5 meters inaccurate.

Also, it helps to Slerp the rotation slowly in case the orientation doesn’t keep up.