# How to pull off Client side projectile hit detection

**URL:** <https://forums.unrealengine.com/t/how-to-pull-off-client-side-projectile-hit-detection/289537>\
**Category:** World Creation\
**Tags:** client, Replication, hit-detection, unreal-engine, projectile, CPP, question\
**Created:** [July 28, 2014, 11:54pm UTC](https://forums.unrealengine.com/t/how-to-pull-off-client-side-projectile-hit-detection/289537 "2014-07-28T23:54:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![xlar8or](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xlar8or/32/710746_2.png) [@xlar8or](https://forums.unrealengine.com/u/xlar8or)\
**Post date:** [July 28, 2014, 11:54pm UTC](https://forums.unrealengine.com/t/how-to-pull-off-client-side-projectile-hit-detection/289537/1 "2014-07-28T23:54:54Z")

</div>

Hello when i fire my weapon i let server know that he needs to spawn a projectile and replicate it to all clients, and that is working. My problem is that i want to use client side detection and i only want to tell server about hit when hit is processed by client that fired projectile. I have a OnHit callback that is called on OnComponentHit event of Sphere component, and i’m running game with 2 clients and a dedicated server. When i hit target with a client, each client triggers OnHit callback 3 times (i assume that it is one for projectile instance in server, another for original client and another for current client). If i put condition Owner-\>IsLocallyControlled() then i can filter 2 cases (ther server and current client instances), but i still need another filter condition to allow me to only execute hit code on client that shot projectile and not replicated versions in other clients.

---

<div class="post-metadata">

**Author:** ![anon26705860](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anon26705860](https://forums.unrealengine.com/u/anon26705860)\
**Post date:** [July 30, 2014, 5:47pm UTC](https://forums.unrealengine.com/t/how-to-pull-off-client-side-projectile-hit-detection/289537/2 "2014-07-30T17:47:29Z")

</div>

Why do you want to do client side detection?

server should have authority over what projectile hits. It is true version of game world. client replicated versions of projectile are just simulated copies of server projectile. client projectile afaik really should have no need to talk back to server.

---

<div class="post-metadata">

**Author:** ![xlar8or](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xlar8or/32/710746_2.png) [@xlar8or](https://forums.unrealengine.com/u/xlar8or)\
**Post date:** [August 3, 2014, 9:12am UTC](https://forums.unrealengine.com/t/how-to-pull-off-client-side-projectile-hit-detection/289537/3 "2014-08-03T09:12:10Z")

</div>

From what i’ve read, more modern shooters are resorting to client side hit detection, for example [this](http://forums.steampowered.com/forums/showthread.php?t=2902453) link tells that Red Orchestra 2 default hit detection method is client side and not server side. I assume that is something related to be more fair to lagged players and also to make feel of gunplay be more responsive, i.e you don’t have to wait for communication and verification of server to register hit. Cheating is not a problem in my game so i’m not worried about that.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e729f54e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e729f54e](https://forums.unrealengine.com/u/anonymous_user_e729f54e)\
**Post date:** [December 29, 2015, 8:56pm UTC](https://forums.unrealengine.com/t/how-to-pull-off-client-side-projectile-hit-detection/289537/4 "2015-12-29T20:56:59Z")

</div>

Hello

After doing a bit of digging I was able to find a page in documentation that appears to handle 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.

Link: [Networking Overview for Unreal Engine | Unreal Engine 5.1 Documentation](https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/Networking/ReplicateFunction/Blueprints/)

Make it a great day

---

<div class="post-metadata">

**Author:** ![xlar8or](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xlar8or/32/710746_2.png) [@xlar8or](https://forums.unrealengine.com/u/xlar8or)\
**Post date:** [December 29, 2015, 9:40pm UTC](https://forums.unrealengine.com/t/how-to-pull-off-client-side-projectile-hit-detection/289537/5 "2015-12-29T21:40:17Z")

</div>

Thanks for info, do you know C++ equivalent?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_33800a51](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_33800a51](https://forums.unrealengine.com/u/anonymous_user_33800a51)\
**Post date:** [January 4, 2016, 3:50pm UTC](https://forums.unrealengine.com/t/how-to-pull-off-client-side-projectile-hit-detection/289537/6 "2016-01-04T15:50:16Z")

</div>

There’s more on RPCs in code here:

> **[RPCs](https://docs.unrealengine.com/5.2/en-US/rpcs-in-unreal-engine/)**
>
> Designating function replication across the network

---

<div class="post-metadata">

**Author:** ![xlar8or](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/xlar8or/32/710746_2.png) [@xlar8or](https://forums.unrealengine.com/u/xlar8or)\
**Post date:** [January 4, 2016, 5:03pm UTC](https://forums.unrealengine.com/t/how-to-pull-off-client-side-projectile-hit-detection/289537/7 "2016-01-04T17:03:39Z")

</div>

Thanks for info 🙂
