How to pull off Client side projectile hit detection
Hello when i fire my weapon i let the server know that he needs to spawn a projectile and replicate it to all the clients, and that is working. My problem is that i want to use client side detection and i only want to tell the server about the hit when the hit is processed by the client that fired the projectile. I have a OnHit callback that is called on the OnComponentHit event of the Sphere component, and i'm running the game with 2 clients and a dedicated server. When i hit the target with a client, each client triggers the OnHit callback 3 times (i assume that it is one for the projectile instance in the server, another for the original client and another for the current client). If i put the condition Owner->IsLocallyControlled() then i can filter 2 cases (ther server and the current client instances), but i still need another filter condition to allow me to only execute the hit code on the client that shot the projectile and not the replicated versions in the other clients.
After doing a bit of digging I was able to find a page in the documentation that appears to handle the type of issue that you are facing and I have provided a link below. If you look under the "Run on owning client" section I believe you will find what you are looking for. I hope that this information helps.
Make it a great day
answered Dec 29 '15 at 08:56 PM
Rudy Q ♦♦ STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here