It is needed if you do the time-stepping on your own (since other parts of your engine depend on it as well) and want to call the physics engine every time step on your own but still need smooth movements of the entities if (and in general it does!) the render frame rate differs from the physics frame rate (which is fixed).
Code: Select all
/// <summary>
/// Updates the interpolated states with a given blend amount factor. Use it together with the parameterless Update method to get a frame rate independent smooth motion of the entities even that the physics engine uses discrete time steps.
/// </summary>
/// <param name="blendAmount">Blend factor describing how far the current frame lies between the last two physics frames. Needs to be in range 0.0 - 1.0f.</param>
public void UpdateInterpolatedStates(float blendAmount)
{
if ((blendAmount < 0.0f) || (blendAmount > 1.0f))
throw new ArgumentOutOfRangeException("blendAmount", "blendAmount needs to be in the range of 0.0f and 1.0f");
BufferedStates.InterpolatedStates.BlendAmount = blendAmount;
BufferedStates.InterpolatedStates.Update();
}
trick