Client-side movement with weird attachment wile moving

I’m still learning multiplayer replication and can’t figure out an issue with movement. The setup is an Actor Component inside an Actor, on the server, I attach the Player Character to that actor and send input to control it.

The attachment works, and the input is received correctly, but the movement behaves differently on the client than on the server, the problem only occurs on the client side.

I’m clearly missing something, but I haven’t been able to identify what. Any ideas on what I should check?


I’m using AddActorWorldOffset() and AddActorWorldRotation() inside the actor component Tick() to simulate the movement, and using AttachToComponent() with ServerRPC to attach the player to the actor.

MopedActor.cpp (5.5 KB)

MopedMovementComponent.cpp (2.9 KB)

run p.NetShowCorrections 1 in the console.

The client is being corrected by the server.

The moped should technically be a PAWN class that you possess.

Attach the character to the moped. Disable movement, set movement mode to none. Unpossess character, then possess moped.

Thank you so much for your help! This is what I made for the moped to work:

  • I changed the moped class from AActor to APawn.
  • When a character enters a seat inside the moped class, I’m disabling its movement, and when it exits, I’m using SetDefaultMovementMode() to reset the movement.
  • If the actor entering a seat is a driver, I’m getting its controller and possessing the moped.
  • I had to create a Server RPC inside the Player Controller to send the possessed moped pawn the movement inputs.
  • I had to make the variables FVector MovementInput and float Speed of the moped movement component as a replicated UPROPERTY(), otherwise only the server would receive the movement and rotation changes of the moped.

Although the movement is still not 100% synchronized, it’s much better than before.

You can smooth it out a bit more by setting up client-side movement prediction like the default character has in CMC.

Review CMC docs for more insight.