physic actor replication

Hi all

I have some trouble with replication of the movement of an physics actor

In my game I have a ball and the player can collide with it to move it, but the movement is’nt the same on the client

I set bReplicates to true and bReplicateMovement to true also

what I need to do more to get the ball working great ?

Is the player client or server side? I have no experience with physics but I guess you collide the clients player with the object and only replicate its movement back to the server, but this is only a guess.

I believe there are no mechanisms by default to ensure that actors with physics simulation stay synchronized. What is the Replicate Movement setting used for then? For example if you have a physics simulated Character actor, its position is affected by:

  • the CharacterMovementComponent
  • physics simulation
  • your custom stuff like calling AddForce in blueprint

Checking Replicate Movement will ensure that the motion caused by the CharacterMovementComponent is replicated but not the physics simulation. I believe (but I’m not sure) that the CharacterMovementComponent makes sure that the character converge to the same world position, but while it is inactive (no input and velocity = 0) there won’t be any syncing since as far as the movement component is concerned its not necessary. You may have seen that sometimes the physics actor’s position does sync, for example when bumping into it, which is caused by the CharacterMovementComponent being poked.

As for replicating physics, Rama has made a custom solution for himself using a pretty smooth method. You should check out his thread here:

My ball isn’t a character, it’s just an actor in the world, no one is controlling it directly

Hey Talos, I just used the character as an example, my point was the Replicate Movement setting does not replicate physics and applies only (I think) to movement components and some functions like SetActorLocation.

Ok so maybe this is not the preferd way of doing it.
But I found that the only thing i need to do after checking replication and replicate movement is to ensure.
That the AddForce method is called server side and it will sync to all clients.

Hope this helps.