Modify Projectile Velocity On Client
I am currently spawning my projectiles on the server only and replicating them and their movement to the clients.
However, when I modify the projectiles velocity on the server post spawn it doesn't get replicated to the client. This is obviously because the movement component's velocity is not replicated.
This results in jerky projectile movement. Since they are moving at different velocities on the server and client.
I know that I could solve this by creating a new replicated property on my Actor or using a RPC.
However, this seems like something that should be built in since the movement is being replicated.
So I dug into it and found FRepMovement. I figured that setting it's LinearVelocity on the server would fix the issue I'm having with the velocity not being changed on the client. However it did not. Is there really no built in way to update the velocity of the projectile on the server only and have the client get it as well?
I've encountered this problem here many times and I think the answer is no. The solution you proposed with the new replicated property is a good solution or you could also just set it twice every time, one on the client before calling the server and one on the server and viceversa. I agree with you, it seems intuitive to have a movement component replicated by default since location and velocity are already replicated by default, but I don't know why it isn't like that.
Follow this question
Once you sign in you will be able to subscribe for any updates here