Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Network Transform Documentation (interpolation)

Discussion in 'Multiplayer' started by LucasZombieMontec, Jun 10, 2015.

  1. LucasZombieMontec

    LucasZombieMontec

    Joined:
    Jun 10, 2015
    Posts:
    3
    I'm trying to learn the new network features (UNet) and the Network Transform needs some explanations. What are the meanings of the values? I mean, I can understand movement threshold (only sends data if the player moved more than that) but what about snapping? What is snapping? Does it make the transform jitter on a grid? It is supposed to make the movement choppy? Can I make it 0?
    Also, interpolation isn't clear. No matter what value I plug my character movement is always choppy. Is this a linear interpolation? Does it handle prediction? Would it be a better choice to code my own network transform?

    Sorry for this messy thread, I'm just too excited that I'll be able to make 3D multiplayer games soon enought. It is a child dream of mine =)
     
    liortal and erebel55 like this.
  2. Shinyclef

    Shinyclef

    Joined:
    Nov 20, 2013
    Posts:
    502
    I think I read somewhere that interpolation works depending on the movement type. In particular, it doesn't work for transform movement, but does work for rigidbody movement. Perhaps that means it will work if you put a kinematic rigidbody on it. Maybe someone else can offer more information.
     
  3. LucasZombieMontec

    LucasZombieMontec

    Joined:
    Jun 10, 2015
    Posts:
    3
    This is bad =( ... I could sync the character rigidbody anyway. Why wouldn't they apply interpolation on transform movement? It is quite easy. I tried using with the character controler movement but it was just as choppy, no interpolation applied.
     
  4. ChrisSch

    ChrisSch

    Joined:
    Feb 15, 2013
    Posts:
    763
    They'll probably get to the transform interpolation in 5.1.1 or something.

    As for other things, I think snap is a threshold at which the object just snaps to the new received position. For example if it's set to 5, and since the last received position intformation the object moved more than 5 units, it'll snap to the new position. In case of lag to prevent delayed interpolations I guess, if I'm correct. You know how in some games online players teleport all over the place when its lagging? That would be snapping. While in other games they don't do that but it takes a while for the interpolated player to reach the actual position.

    Network send rate is how many times per second do you send the new transform info. Default is 9, as in every 100ms or so.

    The rest is self explanatory I think. But ask if you don't understand. I just started exploring it like yesterday, and didn't mess much with multiplayer stuff before UNET so I'm pretty green too. :p
     
  5. AlwaysBeCoding247

    AlwaysBeCoding247

    Joined:
    Jan 27, 2014
    Posts:
    41
    @LucasZombieMontec If you don't feel comfortable implementing the interpolation yourself look on YouTube for GamerToGameDeveloper. I cant get the link but he's here on the forum too. He has a video on manually doing interpolation in his UNet series that I think is a solid base. It's good to learn how these things work a little under the hood in my opinion anyway so you can tweak to your games needs if needed
     
    Tset_Tsyung and ChrisSch like this.
  6. LucasZombieMontec

    LucasZombieMontec

    Joined:
    Jun 10, 2015
    Posts:
    3
    His tutorials aren't working with the current build. Also he has given up because of bugs and lack of documentation =(
     
  7. rob_vld

    rob_vld

    Joined:
    Jul 9, 2013
    Posts:
    190
    Is this because of a bug or will this not be supported?

    I was under the impression that interpolation and extrapolation was handled for all movement types?
     
  8. Shinyclef

    Shinyclef

    Joined:
    Nov 20, 2013
    Posts:
    502
    I don't know if it's a bug or not. I'd also like to know.
     
  9. gsus725

    gsus725

    Joined:
    Aug 23, 2010
    Posts:
    250
    Does NetworkTransform use prediction to compensate for latency?
     
  10. RealSoftGames

    RealSoftGames

    Joined:
    Jun 8, 2014
    Posts:
    220
    when testing this in the latest build 5.1.0 it seems that the least choppy feel is with Sync Transform. also increase the Network send rate, this should work fine if you plan on using this to test with till it gets fixed. however I do not know much about networking, but playing around with it I got some nice results without jitter. Good luck
     
  11. AubryStrawberry

    AubryStrawberry

    Joined:
    Jul 21, 2014
    Posts:
    4
    Does anyone know whether it is possible to sync a skeleton with NetworkTransform?

    So have it sync child object transforms recursively
     
  12. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    I'm also hoping for more information on network transform interpolation.

    I use network transform for synching NPC monsters. I use Sync Transform with the highest send rate of 29. Interpolation seems to have no effect here. At least, I haven't noticed any differences between test values of 1.0, 5.0 and 0.1. However, it would be nice if it is added because even on LAN, monster movement is a bit stuttering and not completely smooth.
     
  13. Capn_Andy

    Capn_Andy

    Joined:
    Nov 20, 2013
    Posts:
    80
    The docs are terrible ( http://docs.unity3d.com/ScriptReference/Networking.NetworkTransform-interpolateMovement.html ) on this but I *believe* the interpolation is a simple Lerp, which means values of and higher than 1 all do the same interpolation. I see visible results with values ~0.01 to ~0.1 or so, with a maxed network send rate.

    (It seems to work fine when set to transform mode and no rigidbody, though it doesn't appear to work when nested as a child object. Add the NetworkVisualizer gameobject to help figure out what's going on)
     
    moco2k likes this.
  14. Chrispins

    Chrispins

    Joined:
    Dec 9, 2014
    Posts:
    15
    Does anybody have any info about Sync Transform interpolation yet? I can't seem to see any difference between Interpolate Mover values between 1 and 0.00001.
     
  15. ChrisSch

    ChrisSch

    Joined:
    Feb 15, 2013
    Posts:
    763
    I haven't touched the multiplayer in a while, but that interpolation setting was only for rigidbody last time I played with it. And from what I've heard, you're best off making your own system for interpolation. There's user tutorials you can find on youtube. Just make sure to seach for UNET (and maybe in time period after the release) so you get the new multiplayer videos not the old ones.
     
  16. Chrispins

    Chrispins

    Joined:
    Dec 9, 2014
    Posts:
    15
    Yea I think I found a good UNet tutorial from the Youtube channel GTGD, but I'm just worried that sending all those commands every FixedUpdate() tick would be bad for the network traffic. I don't know much about networking though, so I might be worried about nothing.
     
  17. ChrisSch

    ChrisSch

    Joined:
    Feb 15, 2013
    Posts:
    763
    I think that's a good source. You should also check out other samples and examples here on the forums. And search/ask a specific question.
     
  18. jroto23

    jroto23

    Joined:
    Oct 19, 2015
    Posts:
    82
    I just got matchmaker working and on the computer that created the room, everything moves around fine. On computers that join a room, it's all jittery. I messed around with changing the setting in the inspector while it was running and saw no efffect. Does anyone know if changing them while its running is ok? or do I have to actually stop the game, make the changes and thenstart it up again?

    I was so disappointed. I got the matchmaking working and two 3d characters running around in the same scene, except the client (joined) computer, the character was all jittery.

    Anyone solved this? I wish Unity would chime in on this thread.
     
  19. ChrisSch

    ChrisSch

    Joined:
    Feb 15, 2013
    Posts:
    763
    I'm pretty sure you have to build every time you change something. Try first getting it running smooth on the same computer. In other words run a few instances of the game on the same computer at the same time.
     
  20. jroto23

    jroto23

    Joined:
    Oct 19, 2015
    Posts:
    82
    thanks;
    I worried that even if I do get it running smooth local, that thoes setting won't work for a client in another city or state.
     
    Last edited: Dec 15, 2015
  21. ChrisSch

    ChrisSch

    Joined:
    Feb 15, 2013
    Posts:
    763
    I'd first get it running properly on my computer, then once I see its running the way it should, I'd start bothering moving for each computer I want to test. They're not in the same room for me, so its an issue. :D
     
  22. jroto23

    jroto23

    Joined:
    Oct 19, 2015
    Posts:
    82
    Chris,
    Did you ever get the jittering to stop?
     
  23. ChrisSch

    ChrisSch

    Joined:
    Feb 15, 2013
    Posts:
    763
    I only played with it a little, so I'm not someone most suited answering you, and didn't do any special coding for interpolating. I just used the network transform set to rigidbody. And its fine for some basic stuff, but for example if you bounce off a wall, that motion will be interpolated and other players will see you bounce off of air in front of that wall. :p

    I think you're better off starting a new thread describing your issue.
     
  24. SweatyChair

    SweatyChair

    Joined:
    Feb 15, 2016
    Posts:
    140
    A year passed and the document still unclear, guess we still need to spend time implementing our own interpolation system?
     
  25. TheOnlyProphet

    TheOnlyProphet

    Joined:
    Aug 29, 2016
    Posts:
    7
    Let me know if you found anything. I have a problem where the ball is like almost moving smoothly, but in the collision moment the ball kind of goes a bit inside my player(only on client that joined host).
     
  26. Deleted User

    Deleted User

    Guest

    Put this script on your player Object (dont forget to delete NetworkTransform component)
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.Networking;
    4.  
    5. public class NetworkSyncTransform : NetworkBehaviour
    6. {
    7.     [SerializeField]
    8.     private float _posLerpRate = 15;
    9.     [SerializeField]
    10.     private float _rotLerpRate = 15;
    11.     [SerializeField]
    12.     private float _posThreshold = 0.1f;
    13.     [SerializeField]
    14.     private float _rotThreshold = 1f;
    15.  
    16.     [SyncVar]
    17.     private Vector3 _lastPosition;
    18.  
    19.     [SyncVar]
    20.     private Vector3 _lastRotation;
    21.  
    22.     void Update()
    23.     {
    24.         if (isLocalPlayer)
    25.             return;
    26.  
    27.         InterpolatePosition();
    28.         InterpolateRotation();
    29.     }
    30.  
    31.     void FixedUpdate()
    32.     {
    33.         if (!isLocalPlayer)
    34.             return;
    35.  
    36.         var posChanged = IsPositionChanged();
    37.  
    38.         if (posChanged)
    39.         {
    40.             CmdSendPosition(transform.position);
    41.             _lastPosition = transform.position;
    42.         }
    43.  
    44.         var rotChanged = IsRotationChanged();
    45.  
    46.         if (rotChanged)
    47.         {
    48.             CmdSendRotation(transform.localEulerAngles);
    49.             _lastRotation = transform.localEulerAngles;
    50.         }
    51.     }
    52.  
    53.     private void InterpolatePosition()
    54.     {
    55.         transform.position = Vector3.Lerp(transform.position, _lastPosition, Time.deltaTime * _posLerpRate);
    56.     }
    57.  
    58.     private void InterpolateRotation()
    59.     {
    60.         transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(_lastRotation), Time.deltaTime * _rotLerpRate);
    61.     }
    62.  
    63.     [Command(channel = Channels.DefaultUnreliable)]
    64.     private void CmdSendPosition(Vector3 pos)
    65.     {
    66.         _lastPosition = pos;
    67.     }
    68.  
    69.     [Command(channel = Channels.DefaultUnreliable)]
    70.     private void CmdSendRotation(Vector3 rot)
    71.     {
    72.         _lastRotation = rot;
    73.     }
    74.  
    75.     private bool IsPositionChanged()
    76.     {
    77.         return Vector3.Distance(transform.position, _lastPosition) > _posThreshold;
    78.     }
    79.  
    80.     private bool IsRotationChanged()
    81.     {
    82.         return Vector3.Distance(transform.localEulerAngles, _lastRotation) > _rotThreshold;
    83.     }
    84.  
    85.     public override int GetNetworkChannel()
    86.     {
    87.         return Channels.DefaultUnreliable;
    88.     }
    89.  
    90.     public override float GetNetworkSendInterval()
    91.     {
    92.         return 0.01f;
    93.     }
    94. }
    btw check my blog, for source code of a project.
    https://wobesdev.wordpress.com/2016/09/09/networking-on-unity5/
     
    IgorAherne and Nolex like this.
  27. TheOnlyProphet

    TheOnlyProphet

    Joined:
    Aug 29, 2016
    Posts:
    7
    I tried this code, but the ball is still wierd and jittering, but if I lower the lerprate it becomes smooth, but inaccurate. The wierd thing is that I have 2 players which have the Network Transform component synchronizing Rigidbody2D and they look smooth and accurate, but when I put the same component on my ball it isn't smooth although it is accurate (accurate meaning that it follows the same path as in host/server).
     
  28. TwistedSage

    TwistedSage

    Joined:
    Dec 12, 2012
    Posts:
    21
    This is interesting. I would like to hear from Unity on the build in interpolation (if any). I tried rigidbody and transform and the only thing that makes it appear "smoother", is when I up the transfer rate. The interpolation options appear to do nothing at all...
     
  29. Deleted User

    Deleted User

    Guest

    Try to do something like this: you need to disable your Rigidbody for other players by default in player Prefab isKinematic must be false, and true isKinematic only for player, just try to call onstartlocalplayer method like this public override void OnStartLocalPlayer() { isKinematic = true; } (Just example). Otherwise, you will get somerhing like you told me.
     
  30. TheOnlyProphet

    TheOnlyProphet

    Joined:
    Aug 29, 2016
    Posts:
    7
    Well I tried it, but now my client can't hit the ball at all because it is kinematic. As I said before , my players are moving just fine with NetworkTransform component, but my ball which is spawned by Server(which is the host basically) isn't smooth and accurate at the same time.

    I thought about it and I think that all I need to do is get the position of the ball at the moment and get the new updated position and then smoothly move the ball to that position(if that makes any sens) which I think is called interpolation. Well I have to learn more about this I guess.
     
  31. Deleted User

    Deleted User

    Guest

    idk why, but in my case everything goes smooth and with interpolation of rot and pos.
     
  32. Driiades

    Driiades

    Joined:
    Oct 27, 2015
    Posts:
    151
    They have to rewrite all this component.

    It's NOT the general approache for network movement synchronisation.
     
  33. emotitron

    emotitron

    Joined:
    Oct 9, 2016
    Posts:
    41
    At a glance, is this code not interpolating opponent player objects between your own interpolated positions rather than absolute time-stamped state changes from the server? It seems what is needed is some kind of callback that triggers when an enemy transform state is received, and then that position should be timestamped (either locally or ideally by the opponent client). To do this right I think I would need to know the last synced Transform and its time, and the current synced transform and its time... and from that I would derive the velocity vector to apply each frame until a new correct position arrives?

    If that all makes sense.

    [edit] Looking at the code closer, it looks more like you are creating a trailing average of where the sync transforms were - rather than updating to the correct position with each sync and interpolating frames between syncs based on the implied velocity?
     
    Last edited: Dec 17, 2016
  34. Deleted User

    Deleted User

    Guest

    I'm Lerping in my Update function the current Transform pos of Client with incoming Vector3 from SyncVar, so I always Interpolate my pos and rot each frame. As a result we have a smooth moves even with 150+ ping.
    If you want to Sync Rigidbody and physics, huh, a way you can do, allow to client to play with physics but send only transform, so You have next: The player prefab with isKinematic by default, in method OnStartLocalPlayer, you are allow your Avatar to control rigidbody but instead of sending velocity e.t.c, you can send position and rotation.



    Desc: the ghost is a RealTime position of client player, fully black is a Interpolated transform position.
     
    Last edited by a moderator: Dec 18, 2016
  35. emotitron

    emotitron

    Joined:
    Oct 9, 2016
    Posts:
    41
    Yeah, that was what it was looking like - interpolation of past positions rather than extrapolating guesses at future positions. It generates a bit of additional latency in how the players see one another over the network, but the reward is much smoother movement (since there is no prediction going on). As I progress with my first try at a network game I am going to see if I can find a happy medium of the two - such as lerping between the last known position and my predicted position or something. Thanks for the reply!

    I have been having pretty good success so far with using rigidbody syncing combined with this transform interpolation script.
    https://gist.github.com/poemdexter/6394993

    It works, and I have yet to get a chance to figure out why it works when it seems like it shouldn't.
     
    nxrighthere and Deleted User like this.
  36. Deleted User

    Deleted User

    Guest

    Thanks, nice post!
     
  37. Orr10c

    Orr10c

    Joined:
    Sep 11, 2016
    Posts:
    45
    I used the the sync rigidbody 3d, the rotation was great but the movement was very very lagy and the position updated after a long distance travel, so I tried sync character controller and the movement dramatically improved! But than the rotation became lagy, does any know of a good compromise between the two? I'll be happy to hear :)
     
  38. dansyrotyn

    dansyrotyn

    Joined:
    Oct 16, 2012
    Posts:
    14
    Hey dude, i've modified Your script. Now it can be used also for mobs. And no lag on start
     

    Attached Files:

    Deleted User likes this.
  39. Deleted User

    Deleted User

    Guest

    Hi, what kind of lag on start? Like the _lastPosition is Vector3.zero? and the client start to Interpolate from Vector3.zero to transform.position?
     
  40. AzatKhafizov

    AzatKhafizov

    Joined:
    Dec 27, 2014
    Posts:
    3
    Hello, Orr10c
    Try syncing movements like in multiplayer tutorial by Brackeys:

    In Network Transform component he uses "Sync Rigidbody 3D" in Transform Sync Mode and tweaks it a bit. I repeated his steps with Unity 5.6.0f3 and got good results.

    Hope, it helps you
     

    Attached Files:

    Deleted User likes this.
  41. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    514
    Hi Guys,

    UNET Network Transform currently has issues and causes my character to jitter. It's also not very optimized in terms of sending and receiving byte data. Here is my version if anyone wants to give it a try :-

    Code (CSharp):
    1.  
    2. // ================================================================================================
    3. // Network Sync Transform
    4. //
    5. // Optimized Synchronization for transform position and rotation
    6. //
    7. // Server sends delta position and rotation updates to the client via Unreliable Channel Rpc Calls
    8. //
    9. // Rotations are properly lerped on the server ensuring that negative angles are corrected to
    10. // remove spinning.
    11. //
    12. // Author : GXMark
    13. // Virtuoso Game Studios, May 2017
    14. // ===============================================================================================
    15. using UnityEngine;
    16. using UnityEngine.Networking;
    17.  
    18. public class NetworkSyncTransform : NetworkBehaviour
    19. {
    20.     public bool rotateSyncX = true;
    21.     public bool rotateSyncY = true;
    22.     public bool rotateSyncZ = true;
    23.  
    24.     [SerializeField]
    25.     float lerpRatePos = 0.4f;
    26.  
    27.     [SerializeField]
    28.     float lerpRateRot = 0.4f;
    29.  
    30.     [SerializeField]
    31.     float serverPosDistanceThreshold = 0.05f;  // Server position distance threshold
    32.  
    33.     [SerializeField]
    34.     float serverRotDeltaThreshold = 3f;        // Server rotation threshold
    35.  
    36.     // Server Variables
    37.     private Vector3 _lastPos = Vector3.zero;
    38.     private float _lastRotX;
    39.     private float _lastRotY;
    40.     private float _lastRotZ;
    41.  
    42.     // Client Variables
    43.     private Vector3 _targetPos;
    44.     private float _targetRotX;
    45.     private float _targetRotY;
    46.     private float _targetRotZ;
    47.  
    48.  
    49.     public override void OnStartClient()
    50.     {
    51.         base.OnStartClient();
    52.         _targetPos = transform.position;
    53.     }
    54.  
    55.     // Fixed Updates
    56.     void FixedUpdate ()
    57.     {
    58.         // Server
    59.         if (isServer)
    60.         {
    61.             // Update the position and rotation (x,y,z) which exceed limit
    62.             UpdatePosRotDeltas();
    63.         }
    64.      
    65.         if (isClient)
    66.         {
    67.             // Lerp to target position
    68.             LerpToTargetPosition();
    69.  
    70.             // Lerp to target rotation
    71.             LerpToTargetRotation();
    72.         }
    73.     }
    74.  
    75.     // Properly Lerp between two angles
    76.     private Vector3 AngleLerp(Vector3 StartAngle, Vector3 FinishAngle, float t)
    77.     {
    78.         float xLerp = Mathf.LerpAngle(StartAngle.x, FinishAngle.x, t);
    79.         float yLerp = Mathf.LerpAngle(StartAngle.y, FinishAngle.y, t);
    80.         float zLerp = Mathf.LerpAngle(StartAngle.z, FinishAngle.z, t);
    81.         Vector3 Lerped = new Vector3(xLerp, yLerp, zLerp);
    82.         return Lerped;
    83.     }
    84.  
    85.     // Client lerps from current position to target position
    86.     private void LerpToTargetPosition()
    87.     {
    88.         transform.position = Vector3.Lerp(transform.position, _targetPos, Time.fixedDeltaTime * lerpRatePos);
    89.     }
    90.  
    91.     // Client lerp from current rotation to target rotation
    92.     private void LerpToTargetRotation()
    93.     {
    94.         Vector3 targetRot = new Vector3(rotateSyncX ? _targetRotX : transform.eulerAngles.x,
    95.                                       rotateSyncY ? _targetRotY : transform.eulerAngles.y,
    96.                                       rotateSyncZ ? _targetRotZ : transform.eulerAngles.z);
    97.  
    98.         transform.eulerAngles = AngleLerp(transform.eulerAngles, targetRot, Time.fixedDeltaTime * lerpRateRot);
    99.     }
    100.  
    101.  
    102.  
    103.     /// <summary>
    104.     /// Server updates for position and rotation x,y,z when delta thresholds are exceeded
    105.     /// </summary>
    106.     private void UpdatePosRotDeltas()
    107.     {
    108.         if (Vector3.Distance(transform.position, _lastPos) > serverPosDistanceThreshold)
    109.         {
    110.             RpcSetPosition(transform.position);
    111.             _lastPos = transform.position;
    112.         }
    113.            
    114.         if (rotateSyncX)
    115.         {
    116.             if (Mathf.Abs(Mathf.DeltaAngle(transform.eulerAngles.x, _lastRotX)) > serverRotDeltaThreshold)
    117.             {
    118.                 RpcSetRotX(transform.eulerAngles.x);
    119.                 _lastRotX = transform.eulerAngles.x;
    120.             }
    121.         }
    122.  
    123.         if (rotateSyncY)
    124.         {
    125.             if (Mathf.Abs(Mathf.DeltaAngle(transform.eulerAngles.y, _lastRotY)) > serverRotDeltaThreshold)
    126.             {
    127.                 RpcSetRotY(transform.eulerAngles.y);
    128.                 _lastRotY = transform.eulerAngles.y;
    129.             }
    130.         }
    131.  
    132.         if (rotateSyncZ)
    133.         {
    134.             if (Mathf.Abs(Mathf.DeltaAngle(transform.eulerAngles.z, _lastRotZ)) > serverRotDeltaThreshold)
    135.             {
    136.                 RpcSetRotZ(transform.eulerAngles.z);
    137.                 _lastRotZ = transform.eulerAngles.z;
    138.             }
    139.         }
    140.     }
    141.  
    142.     [ClientRpc(channel = (int)QosType.Unreliable)]
    143.     private void RpcSetPosition(Vector3 position)
    144.     {
    145.         _targetPos = position;
    146.     }
    147.  
    148.     [ClientRpc(channel = (int)QosType.Unreliable)]
    149.     private void RpcSetRotX(float rotX)
    150.     {
    151.         _targetRotX = rotX;
    152.     }
    153.  
    154.     [ClientRpc(channel = (int)QosType.Unreliable)]
    155.     private void RpcSetRotY(float rotY)
    156.     {
    157.         _targetRotY = rotY;
    158.     }
    159.  
    160.     [ClientRpc(channel = (int)QosType.Unreliable)]
    161.     private void RpcSetRotZ(float rotZ)
    162.     {
    163.         _targetRotZ = rotZ;
    164.     }
    165. }
    166.  
    167.  
    168.  
     
    Last edited: May 20, 2017
  42. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    You need to replace Time.delta time with Time.fixedDeltaTime btw. You are calling Lerp from FixedUpdate.

    But TBH. You should probably do your lerping in Update.
    In addition, you most likley don't want to lerp at all on Server. So you should probably just snap to the positions on the server
     
    Last edited: May 18, 2017
  43. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    514
    Thanks updated
     
  44. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    514
    The above code has been fully tested on the opsive third person controller forum community with the thumbs up.
     
  45. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    After taking a second look. You most likley want to change the Unreliable channel to unreliable sequenced. If you have already applied a newer position / rotation it would cause issues to then apply an older one.

    And you most likley want to run your Lerps in Update instead of fixed update. Otherwise you can get jitter effects.
    In addition you probably want the LerpSpeed to be connected to the sendrate so that you have precalculated that when the next packet is supposed to arrive we have just arrived at our lerp position. Otherwise you might only be half way through the lerp when next update arrives which kindoff defeats the purpose of Lerping.
     
    pumpedbarbarous likes this.
  46. hexagonius

    hexagonius

    Joined:
    Mar 26, 2013
    Posts:
    98