I thought it would implement correctly, but it doesn't seem to work - every so often it starts to throw wierd position offsets...
Here is my python interpretation:
# Updated every network recv tick_rate = 60 network_packet = 6 #tick_0 = ... tick_1 = ... current_tick == ... position_0, orientation_0, velocity_0 = state_0 position_1, orientation_1, velocity_1 = state_1 position_now = user.worldPosition.copy() # Extrapolated (current) position according to tick 0 position_acc_tick_0 = position_0 + velocity_0 * ((tick_now - tick_0) / tick_rate) # Extrapolated (current) position according to tick 1 position_acc_tick_1 = position_1 + velocity_1 * ((tick_now - tick_1) / tick_rate) # Get the error between two predictions as a velocity vector velocity_err = (position_acc_tick_1 - position_acc_tick_0) / ((tick_1 - tick_0) / tick_rate) # Get the estimated position the client needs to be at in one network ticks time, accounting for error position_out = position_acc_tick_1 + velocity_err * ( (tick_now - tick_1 + network_packet) / tick_rate ) # Get's velocity needed to move from current position to target position within one network tick needed_velocity = (position_out - position_now) / (network_packet / tick_rate) # Updated every frame new_velocity = needed_velocity * ((current_tick - packet_tick) / tick_rate)
Can you see any problems with this? The only other problem i can foresee is a problem with the arrival times.
I beleive it was caused by a side effect of having the logic processed before physics; linv didn't account for friction.
However, my question still remains about orientation and mouselook - where is it handled?