Client predicted, server auth using commands with physics has some jitter.

Options
SUGBOERIE
SUGBOERIE
edited January 2021 in Photon Bolt
I've implemented client prediction, server auth movement with physiscs based on the paid sample pack example. Where I add the physics car to it's own physics scene and manually update it in the ExecuteCommand method. For the most part it works fine but when the car is drifting on the client, the jitter is really bad. I've tried all variations of the state replication and smoothing algorithm but with no luck, they all result in similar experiences.

What am I missing or doing wrong? Can this be fixed?

https://www.youtube.com/watch?v=A7JZiHdZaTI&feature=youtu.be

tf02ppp.png

private void SimulateInCarController()
{
    ICarCommandInput input = CarCommand.Create();
    input.Acceleration = carActions.Acceleration.Value;
    input.Steering = carActions.Steering.Value;
    input.Handbrake = carActions.Handbrake.IsPressed;
    input.Shooting = carActions.Shoot.IsPressed;
    input.ShootWasPressed = carActions.Shoot.WasPressed;
    input.ShootWasReleased = carActions.Shoot.WasReleased;
    input.Boost = carActions.Boost.WasPressed;
    input.EnterExitCarWasPressed = characterActions.EnterExitCar.WasPressed;
    input.ChangeCameraView = carActions.ChangeCameraView.WasPressed;
    entity.QueueInput(input);
}

private void ExecuteCommand(Command command, bool resetState)
{
    CarCommand cmd = (CarCommand) command;

    if (car == null)
        return;

    if (resetState)
    {
        car.transform.position = cmd.Result.Position;
        car.transform.rotation = cmd.Result.Rotation;
        carRigidbody.velocity = cmd.Result.Velocity;
        carRigidbody.angularVelocity = cmd.Result.AngularVelocity;
    }
    else
    {
        carInput.Acceleration = cmd.Input.Acceleration;
        carInput.Steering = cmd.Input.Steering;
        carInput.Handbrake = cmd.Input.Handbrake;
        carInput.Shooting = cmd.Input.Shooting;
        carInput.ShootPressed = cmd.Input.ShootWasPressed;
        carInput.ShootReleased = cmd.Input.ShootWasReleased;
        carInput.Boost = cmd.Input.Boost;

        car.Move(carInput);

        car.Shoot(carInput);

        if (cmd.Input.ChangeCameraView)
        {
            character.ChangeCameraView();
        }

        if (cmd.Input.EnterExitCarWasPressed && Time.frameCount != enterExitCarFrame)
        {
            character.ExitCar();
            enterExitCarFrame = Time.frameCount;
        }

        carPhysics.ManualFixedUpdate();

        if (!BoltNetwork.IsServer)
            arenaPhysicsScene.Simulate(Time.fixedDeltaTime);

        cmd.Result.Position = car.transform.position;
        cmd.Result.Rotation = car.transform.rotation;
        cmd.Result.Velocity = carRigidbody.velocity;
        cmd.Result.AngularVelocity = carRigidbody.angularVelocity;
    }
}