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?

Hi w0hoho,

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.

IMPORTANT NOTES:

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.

Good luck!

llll_Sabre_llll

Hey, thank you so much for your answer.

Unforunately this doesn’t work for me. My project is top down shooter and I already tried it and it doesn’t replicate character rotation. I did like this:

And my shooting script is like this:

Client shoots from the same location, wherever you look or move. I guess it shoots from its first location when it spawns and doesn’t change after that. Server side is okay. Projectiles and particles are also okay.

Somehow with my original playercontroller blueprint, client does not spawn, it shows under the landscape. I couldn’t figure out its reason. When I change controller bp, it is okay. But the multiplayer system is the same system with my other project and it works fine in that.

Still need help with this.