I’m still somewhat new to Unreal Engine 4 and I’m currently creating a small FPS for my college course. I’ve managed to create a health and damage system but I’ve run into a problem where the FirstPersonProjectile would harm the player firing it when aiming at certain angles. Is there anyway where I can make projectile ignore my own hitbox but still come in contact with other players?
How to make FirstPersonProjectile not harm the player who fired it
When you span projectile set it’s owner (“Set Owner” node) to actor that fired it. Now any collision event you doing check if owner (Get Owner btw you dont need to cast it to use that node) of projectile that triggered the event is not actor that revived the event, if it is stop the event
Can I get a visual example? Please?
sorry I am not at my computer to give a screenshot. But it is very simple. Just use a branch and a couple of right clicks typing things like Shadowriver said:
In the node that spawns the projectile there is a pin that might be hidden at the bottom. Click the little expander arrow at the bottom to reveal the Owner pin.
Connect the player who is firing’s pawn or controller to the Owner pin on that spawnActorFromClass node.
Then in the bullet’s event that handles collisions, check if the Other actor it collided with Equals the Owner (every Actor has the Owner variable built in I think) then use that Equals in a branch. If true, do nothing. If false, then the projectile hit somebody else and not the owner.