Announcement

Collapse
No announcement yet.

[Tutorial] Smooth movement on Multiplayer while Replicating Movement of a Actor for the Client.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [Tutorial] Smooth movement on Multiplayer while Replicating Movement of a Actor for the Client.

    All the players execute this part on the Tick when you need to move the Actor. The code make it smooth for the Client by comparing the Actual Position that can be corrected by the server with the Old Position and just adjust how much it need to move.

    • The first part is the Acceleration(you can remove it if not needed).
    • Them you Add Transform to the Actor you want adding the Speed(always based on the Delta Seconds).
    • I added a verification if the player have the Old Location Set.
    • The part that make the correction is just Picking the Actual Position that maybe is correct by the Server Replication and subtract by the Old Location getting the distance that the Server moved the Actor, than subtract again in the Speed making the Actor just moving what it needed.
    • After adding the Speed you just save the Actual Location at the Old Location Var.




    Extra Tip:
    • Make a simple start of Movement for everyone with a Replicated Boolean in the Tick.
    • Mark for the Actor be Replicated and to Replicate Movement.
    Last edited by HeliaXDemoN; 07-12-2019, 12:16 PM.

    #2
    Removed the begin play part that is unnecessary.

    Comment

    Working...
    X