Thanks for looking ...
We need someone to fix an interpolation issue we are having in a multiplayer chat world based on the SFS Island Demo.
Its the interploation method in the TransformReceiver
There are 2 issues we are getting,
1. When lag is introduced, the player animation calls run out, but the interpolation transforms are still happening, so the player slides without playing any animation until they hit the final interpolation transform point
2. The interpolation is making the character walking 'jagged'. We are using .1 int he receiver and the sender so they match. We tried .05 and it made it worst, and we tried .2 and that made it worse. It seems like .1 is the best setting, but it just isnt smooth.
Code: Select all
// This method is called in every Fixed Update in receiving mode. And it does transform interpolation to the latest state.
void InterpolateTransform() {
// If interpolationg
if (interpolationPoint < maxInterpolationPoints) {
interpolationPoint++;
float t = interpolationPoint*interpolationDelta;
if (t>1) t=1;
transform.position = Vector3.Lerp(interpolateFrom.position, interpolateTo.position, t);
transform.rotation = Quaternion.Slerp(interpolateFrom.rotation, interpolateTo.rotation, t);
}
else {
// Finished interpolating to the next point
if (interpolateTo!=null) {
// Fixing interpolation result to set transform right to the next point
transform.position = interpolateTo.position;
transform.rotation = interpolateTo.rotation;
}
// Take new value from queue
if (queue.Count!=0) {
NetworkTransform nextTransform = queue.Dequeue() as NetworkTransform;
//Start interpolation to the next transform
// Set new final interpolation state and reset interpolationPoint
interpolateTo = nextTransform;
// Set new point from which to start interpolation as current transform
interpolateFrom = new NetworkTransform(this.gameObject);
interpolationPoint = 0;
float frameRate = fpsStorage.GetCurrentFPS();
// Calculate the total number of interpolation points as number of frames during interpolationPriod
maxInterpolationPoints = Convert.ToInt32(Math.Round(frameRate * interpolationPeriod));
// Reset interpolation deltaTime
interpolationDelta = 1.0f / Convert.ToSingle(maxInterpolationPoints);
}
else {
// If queue is empty just setting the transform to the last received state
transform.position = lastState.position;
transform.rotation = lastState.rotation;
}
}
}
If you think you can fix this, please let us know your cost, and the timeline,
SFS 1.6.6
Unity 3.1.f (latest release)
Platform: PC/MAC Standalone
Thanks for looking,