x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: UE 4.15
Tags:
more ▼

asked Aug 04 '17 at 10:54 PM in Blueprint Scripting

avatar image

w0hoho
76 11 8 17

avatar image w0hoho Aug 29 '17 at 01:58 AM

Still need help with this.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

alt text

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

more ▼

answered Aug 07 '17 at 10:55 AM

avatar image

llll Sabre llll
8 1 3

avatar image w0hoho Aug 07 '17 at 12:56 PM

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:

alt text

And my shooting script is like this:

alt text

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.

rotate.jpg (253.3 kB)
shooting.jpg (349.0 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question