# Making Homing projectile not targeting the character that shoot it

**URL:** <https://forums.unrealengine.com/t/making-homing-projectile-not-targeting-the-character-that-shoot-it/1245279>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [July 30, 2023, 11:28pm UTC](https://forums.unrealengine.com/t/making-homing-projectile-not-targeting-the-character-that-shoot-it/1245279 "2023-07-30T23:28:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lamaral14](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lamaral14](https://forums.unrealengine.com/u/Lamaral14)\
**Post date:** [July 30, 2023, 11:28pm UTC](https://forums.unrealengine.com/t/making-homing-projectile-not-targeting-the-character-that-shoot-it/1245279/1 "2023-07-30T23:28:11Z")

</div>

Hello, I currently have this system to look for actor with Homing tag:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/f/a/2fa1980a41e889a750bd0b252462556830f12b9d.png)

Some actos with the tag Homing are the same class as the player character, for example:  
My player character is CH\_Human, and some npcs are CH\_human as well.

since the closest actor will always be the player character the projectiles always chase the player character that shot them.

How can i avoid this? Thank you in advance

---

<div class="post-metadata">

**Author:** ![BIGTIMEMASTER](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bigtimemaster/32/710746_2.png) [@BIGTIMEMASTER](https://forums.unrealengine.com/u/BIGTIMEMASTER)\
**Post date:** [July 31, 2023, 12:05am UTC](https://forums.unrealengine.com/t/making-homing-projectile-not-targeting-the-character-that-shoot-it/1245279/2 "2023-07-31T00:05:08Z")

</div>

in addition to check the distance, do a “get player character” and then do an == check on that. If it is the player character, leave the True branch empty.

So, in plain language what you’ll say is:

If the Actor is in range AND is not the player character, then…

---

<div class="post-metadata">

**Author:** ![Lamaral14](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lamaral14](https://forums.unrealengine.com/u/Lamaral14)\
**Post date:** [July 31, 2023, 5:24pm UTC](https://forums.unrealengine.com/t/making-homing-projectile-not-targeting-the-character-that-shoot-it/1245279/3 "2023-07-31T17:24:45Z")

</div>

Well, what if my character is driving a tank and the missile comes from the tank? since i posessed the tank, the character is no longer player controlled. Also how do i make it ignore allies?

---

<div class="post-metadata">

**Author:** ![pezzott1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pezzott1/32/1215068_2.png) [@pezzott1](https://forums.unrealengine.com/u/pezzott1)\
**Post date:** [July 31, 2023, 5:29pm UTC](https://forums.unrealengine.com/t/making-homing-projectile-not-targeting-the-character-that-shoot-it/1245279/4 "2023-07-31T17:29:01Z")

</div>

Use tags to know what to target.

---

<div class="post-metadata">

**Author:** ![BIGTIMEMASTER](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bigtimemaster/32/710746_2.png) [@BIGTIMEMASTER](https://forums.unrealengine.com/u/BIGTIMEMASTER)\
**Post date:** [July 31, 2023, 7:17pm UTC](https://forums.unrealengine.com/t/making-homing-projectile-not-targeting-the-character-that-shoot-it/1245279/5 "2023-07-31T19:17:53Z")

</div>

In my game I have a class for projectiles, and it has a “expose on spawn” (check in the details panel to toggle that) variable for “who fired me”. This is an enum that has entries like, “player, enemy type 1, enemy type 2” etc.

Then on the projectile hit event I can just check that enum in cases where it matters.

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [August 1, 2023, 3:02am UTC](https://forums.unrealengine.com/t/making-homing-projectile-not-targeting-the-character-that-shoot-it/1245279/6 "2023-08-01T03:02:50Z")

</div>

Generate a unique string hash for the character. Add that string to “Actor Tags”.

In the projectile class create a string var, Name it “OwningHash”. Set the var to instance Editable & Expose on Spawn. Pass the characters hash to the projectile on spawn.

In your tracking logic check the OwningHash against potential Targets as an exclusion.

Otherwise, get the hash of tartget and define a “TargetHash”…trace logic for tracking should check each update.

---

<div class="post-metadata">

**Author:** ![Lamaral14](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lamaral14](https://forums.unrealengine.com/u/Lamaral14)\
**Post date:** [August 3, 2023, 3:01pm UTC](https://forums.unrealengine.com/t/making-homing-projectile-not-targeting-the-character-that-shoot-it/1245279/7 "2023-08-03T15:01:26Z")

</div>

Thank you all for the help it worked 🙂

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [September 2, 2023, 3:02pm UTC](https://forums.unrealengine.com/t/making-homing-projectile-not-targeting-the-character-that-shoot-it/1245279/8 "2023-09-02T15:02:07Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
