Quote:Original post by hplus0603
The problem with using that alpha is that, if you want to move from point 0 to point 1 with an alpha of 10 (say), you will move:
In the first timestep, from 0.0 to 0.1
In the second timestep, from 0.1 to 0.19
In the third timestep, from 0.19 to 0.271
...
I e, you'll start out going fast, and "ease off" towards the goal.
There are better interpolators/extrapolators pointed at from the Forum FAQ.
An IIR low-pass filter (LPF) does an excellent job of smoothing motion. The above analysis shows what will happen for two sample points. This will work fine even if an object moves then immediately stops. I find it can look better than ease-in and ease-out, especially for character motion.
For a constant stream of movement data, the IIR LPF will provide high-quality, smoothed motion (at the expense of added filter delay). If one's code results in jumpy motion, it sounds like the ghost is not being simulated with velocity. That is, it sounds like updates are showing up as descrete locations, where the interpolation is always towards a fixed location. If both the local, visual object and ghost object are moving (classic dead-reckoning), the interpolation will be smooth and seamless (as would be expected from an IIR LPF).
I looked through the FAQ, and found Gaffer's article on networked physics. The smooth() function from Cube.h:
Quote:
/// Smooth physics state towards target.
void smooth(const State &target, float tightness)
{
previous = current;
current = target;
current.position = previous.position + (target.position-previous.position) * tightness;
current.orientation = slerp(previous.orientation, target.orientation, tightness);
current.recalculate();
}
The tightness argument is alpha. This is the exact same IIR LPF I posted above. The demo works fine and shows very smooth motion (I also shipped a commercial game using the IIR LPF: the networked game was reviewed as smooth and having no lag (2002)). I tested various spline and other methods, but the simple IIR LPF always won the comparisons for that particular game (I also considered a predictive filter, such as the Kalman Filter (might help mitigate added filter delay), but since the IIR LPF worked so well, I did not pursue further research and testing). A combined IIR LPF + spline method might work better for some types of motion. Carefully changing alpha/tightness can help in reducing delay, but for a basic test and just getting started, it can be fixed.
What method in the FAQ do you see as having better performance?