Client Can't Shoot Mouse Location
All repliation is done. I am using player controller replicated variable to get hit under cursor channel. Server is okay but client doesn't shoot where mouse is. What can I do?
asked Aug 04 '17 at 10:54 PM in Blueprint Scripting
I recently ran into what I think is the problem you have described. (I hope it's the same anyway!) It was baffling to me that the rotation on the client wasn't being taken into account. It turns out that it's not replicated in the same way other elements seem to be automatically. e.g. jump and other movement. Assuming it was, I tried all sorts of things to fix the problem but kept hitting brick walls. (Assuming FirstPersonCharacter) E.g. you can try ticking "Use Controller Rotation Pitch" under the "Pawn" section in FirstPersonCharacter. This will fix the problem but have amusing side effects... :0
The solution I have is shown in the screenshot below.
a) I have not been able to test my project over the net/Steam or even over two PCs, so I don't know this for sure but I am trying to avoid having any Event Tick's as they are probably bad for network performance. That's why my screenshot shows a Delay after the Event Tick. This will not affect the player's ability to shoot wherever you aim, but it will affect the look of where a client is pointing their gun from another client's perspective. So you can tweak this.
b) If you use the Delay node, you should also call "Multicast_ReplicateRot" just before you spawn a projectile, after a "Server_ShootWeapon" or similar. This means that as the Client requests to fire their gun, the rotation will be updated just before it does so.
answered Aug 07 '17 at 10:55 AM
llll Sabre llll
Follow this question
Once you sign in you will be able to subscribe for any updates here