Why my projectile damages shooter as well as the target?

Why does my projectile damage the character that shoots it as well as the target? I only want it to damage the target. My projectile the character shoots out damages him as well as the target it hits. I have a thirdPersonCharacter with health. The projectile is a particle with population on it and a collision. Threw the collision I casted to the ThirdPersonCharacter then added damage at the end. The problem is the target is a duplicate and or child of the ThirdPersonCharacter so they are kind of the same. If i miss the target only the shooter will get damaged.
How do I make it so It will damage only the target? Also I tried to use Hit node but it dosent work. Only the Overlap event works. All the help I can get will be appreciated. Thanks.

I only want the projectile to damage the target only.

Hey buddy,

the problem is not where you apply the damage, its when your spawning the projectile. try and add self to the actors to ignore input in the spawn actor from class. this should then ignore your character.

let me know if this works? @Jazz904

i think to get hits working you need to tick the simulation generates hit event checkbox in collision settings/physics

you could use the owner to pass that self ref on the spawn actor from class node

I’m not sure about the solution by V0xFire, so I’ll post another way.

If your Projectile logic is inide the Character that shoots, one solution would be to test if the actor you hit is the same actor the Particle component is owned by (your character - all characters are also actors). Search for ‘Self’ to get a selfreference node and test if the ‘Other Actor’ from the Hit event is equal.

If your Projectile logic is in a seperate actor then you would need to make sure to give the actor reference on spawn to the Projectile. You can do that by creating a varaible of the type Actor inside the Projectile BP and make it editable and exposed at spawn. You can do that in the details panel if you select the variable. If you compile and add the Spawn Actor from Class node with you Projectile BP class, there should appear an Input for you Actor variable To pass it onto the Instance you are creating.

Thank you guys so much. I really appreciate the help. Ok so V0xFire inside the ThirdPersonCharacter on the spawn projectile node i tried the self node, player cht node, player controller node on both the Owner and instagater input and nothing seems to work. I also tick the hit button in the settings witch was off, I turned on. The Hit node still dosent work at all and on diffrent Projectile_BP’s. How do I use the owner? Do I cast to the 3rdPersonCht?

BoBtheRoss Im not sure I understand what you mean. My hit nodes don’t work so I only can use overlap node. I tried to do that with the overlap node but no good. I will attach images of the Projectile BP and the ThirdPersonCharacter. Both are everything dealing with the projectile.

Everything works. The problem is the projectile damages the spawner shooter and or the target as well. I only want the projectile to damage the target only.

Thank you guys so much for all the help. I look in the forms and I dont see any one else who has this problem.

@Jazz904 ok i think i can solve this with a combination of @BOBtheROSS and my answer.

the hit problem is probably because you don’t have any collision settings ticked for Block they seem to be all set to overlap, changing this should generate a hit event.

  1. add a self node to the owner ref input in the third person character bp on the spawn actor from class node

  2. Inside BP_ElementalEnergy pull out from the other actor on your on component begin overlap and check if its equal to the output from a get owner node hook this up to a branch

  3. if its true then do nothing if its false do damage

does this make sense?

There are some other solutions that go into c++ FCollisionQueryParams | Unreal Engine Documentation and one even wrote a Plugin. Collision Disabler in Code Plugins - UE Marketplace

But here are my solutions for anyone intersted:

Overlap Event:
The two interacting component needs to have their collision response set to Overlap AND both need the ‘Generate Overlap event’ checkbox set to true (it also works if one of them has it set to block)

table by James Golding Collision Filtering - Unreal Engine
Make sure they have set overlap for each others collision type.

First solution would be what you described @V0xFire. Pass over the Character as Owner or Instigator on the Spawn node and test in the Projectile BP, if the overlapping actor equals the reference from the get owner or get instigator node.

Second solution would be to use the ‘ignore actor when moving’ or ‘ignore component when moving’.

Hit Event:
For the Hit event to work both components need to block each others collision type and only the desired component needs to have ‘Simulation Generated Hit Events’ activated. (‘generate overlap events’ can be unchecked)

Some translate nodes have a ‘Sweep’ option to activate (e.g. AddWorldOffset, SetWorldLocation). This basically traces with the Objects collision for other collision. This will generate a Hit Event, when it finds something in the way. Strangely enough Components that are in the same actor can’t block each other this way. With this method (and the ProjectileMovement component) you can use the ‘Ignore Actor when Moving’.

The Workaround would be to use a ‘Physics Constraint’ (set to ‘Free’ on all Axis) to constrain the desired components and use the ‘Disable Collision’ option, available in the Physics Constraint. This only works with physics simulation.

Sorry for the late response
Thank you two so much. I really appreciate it. I did solutions 1-3 and it worked like a charm. Everything works perfectly now. If it’s not too much to ask. One more question please

Hey buddy,

I’m glad we managed to help you :slight_smile:

You can use an enum with a switch to accomplish this simply set the enum on each different weapon, or after you fire the projectile set the value of the enum to the next projectile.

Ps: Don’t forget to mark the answers as resolved

My sequence node doesn’t work so I used the flip flop node. How can I get the sequence working or How can I rotate between all five projectiles another way?

You just mark the answer as correct to resolve or click the upvote arrow on the left hand side, yeah my discord is V0xFire#6592
@Jazz904 add me on there and we can talk realtime

Thank you. Sorry for the wait. the site was down for ah bit. Okay. Im not sure I understand what you mean? Im looking for a simple switch node but i dont see it. I know the node is yellow am i wright but i dont see it. Also might sound like a dumb question but how do i mark it as resolved? I dont see a button for that. Also i have a few more questions I will start a new tread. I follow you V0xfire but is there a way to message you directly? Thanks. I appreciate it.

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