This is my first attempt at multiplayer and I am making a tank game. I am using the control rotation to rotate the top of the tank and barrel. It is working fine on the server side but on the client side the top of the tank is locked in one direction while the camera is still able to move freely. I have used print string to be sue the values running into the run on server node are changing with the control rotation but still no luck. The tick node that is running this is in the player controller while the rest is inside of the tank BP. The classes themselves are replicated. I am sure I am missing something simple. Thank you in advance!
Also tank is made from sedan template which is why the cast to sedan is there.
In your bottom image you are calling ‘HandleRotation’. You dont need to do that because it is being called by the server in the middle image. In bottom image you only need the “RunOnServer” call.
The program flow should be…
- Client tells server to make move
- Event on server calls multicast event on all clients and tells them to make move
- Multicast event on each client makes the move
Also it does matter in which blueprint you placed this.
Dude, why would you have all this painwork when you could just replicate the character actors and let the UE4 does all the trick?
In this quick tutorial you can see how to archive that: - YouTube
By the way, if you want to this in the way you are doing (what I really don’t recommend), you will need to pass a reference of the controller or the character being moved to the Handle Rotation event.
Thank you for you help but unfortunately this doesn’t change the outcome. I have noticed that if I put a delay on the tick event it is actually working but snapping back so it never appeared to be moving. If I remove the authority output on the switch has authority node the clients work fine but the host can no longer move. It appears the the client is calling authority or the server is screwing with the clients. I tried removing the switch all together but it just locks the turret again. The control rotation is locking at 180 degrees on the Z axis for some reason.