Page 1 of 1

Client interpolation

Posted: Tue Mar 15, 2016 7:07 am
by diho
Hi all,

I have a question about client side interpolation.
Say Object A has postion V1, and a update comes in, his position is changed to V2 during a time of X ms.
What is the best way to "recreate" this movement with interpolating the vectors?

-Diho

Re: Client interpolation

Posted: Tue Mar 15, 2016 7:27 am
by thanhle
Using a straightline or spline approximation?

Re: Client interpolation

Posted: Tue Mar 15, 2016 7:39 am
by diho
I guess just a straight line.

Re: Client interpolation

Posted: Tue Mar 15, 2016 9:48 am
by mongoose7
(1 - x)*V1 + x*V2 as x goes from 0 to 1. The speed of Object A (assuming it isn't warping!) is 1000*sqrt(dot((V2 - V1), (V2 - V1)))/X. But you can't change the past, so you need to get A to its next position. So set V2' = 2*V2 - V1. And maybe make it go a little bit faster. You should really always be heading to where A will be at the next update, not where it should be for this update. You use feedback to keep it on course. If it gets too far away, you should just warp it, or write better code.