Fixed snap on the NetworkedTransform component

This commit is contained in:
Albin Corén 2018-03-02 21:54:35 +01:00
parent bc78303957
commit a44141a966

View File

@ -90,6 +90,11 @@ namespace MLAP
{
if((isServer && InterpolateServer) || !isServer)
{
if(Vector3.Distance(transform.position, lerpEndPos) > SnapDistance)
{
//Snap, set T to 1 (100% of the lerp)
lerpT = 1;
}
lerpT += Time.deltaTime / timeForLerp;
transform.position = Vector3.Lerp(lerpStartPos, lerpEndPos, lerpT);
transform.rotation = Quaternion.Slerp(lerpStartRot, lerpEndRot, lerpT);