Game Development Reference
In-Depth Information
How to do it...
Perform the following steps to interpolate between the player positions:
1. To simulate some network problems, set framerate on the server to 10 .
2. If you connect to the server now, the movement will be noticeably jerky.
3. We replace the contents of the controlUpdate method of ClientPlayer-
Control with the following lines to apply the interpolation:
float factor = tpf / 0.03f;
spatial.setLocalTranslation(spatial.getLocalTranslation().interpolateLocal(tempLocation,
factor));
spatial.setLocalRotation(spatial.getLocalRotation().slerp(spatial.getLocalRotation(),
tempRotation, factor));
4. When we connect again and compare the experience, it will be much smoother.
Search WWH ::




Custom Search