How to prevent a projectile being blocked by the instigator

Hello

I have setup a blue print with a collsion sphere, projectile movement and a particle system. I spawn this object from my charcter blueprint when mouse is clicked. I have set collsion mode to ‘Block All’ in the projectile blueprint (in the sphere component). Everything seems to work fine except my projectiles get hit with my character in some cases. I know this is the expected result here. But what I want to do is let the projectile pass though my character and other team memebers.

What changes should I make to achieve it?

I suspect that custom object channels and trace channels might be the answer

On the other hand, this sounds like a problem that would pop up rather frequently, so maybe there is an even simpler solution built in somewhere, but nothing comes to mind.

I tried collision channels, but did not work the way I wanted. I can set Ignore on Pawn channel. But then the projectile wont register hits with opposite team members.

Is there any beforeHit() event available (like in box2d) where after doing checks against the two actors, I could return false to ignore the hit and true to register the hit?

Found the solution:

I used the function MoveIgnoreActors() defined in UPrimitiveComponent. In the PostInitializeComponents() function, I simply added the Instigator to the list of IgnoreActors using this function. I also did the reverse on the Instigator itself (ie added the spawned projectile into the list of IgnoreActors for the Character).

In Blueptints, this can be achieved by using the function ‘Ignore Actor’ called from the Actos’s collsioncomponent or the mesh itself (if there are no separate collisioncomponent defined).

Thanks alot! I’ve been banging my head over this for some time now! :slight_smile:
cheers

Is it the ‘Ignore Actor when Moving’ function? It asks for some component from the instigator pawn to ignore, but I can’t seem to figure out what to give to it.

(edit) Just gave it the primitive component from the player character, but that doesn’t really fix the problem at all.

If you need your projectile to not collide with who fired it, then you plug GetInstigator in to the IgnoreActorWhenMoving node on the projectile. This, of course, requires you to assign an instigator when spawning the projectile in the first place.

On your pawn:

60120-pawn.png

If you spawn the projectile on your character blueprint, then plug in Self as the instigator.

On your projectile:

1 Like

Great answer, really fixed my problem effeciently!!
I always forget the answer to “Who fired the gun?” … The Instigator, so it helps be get in the habit of making sure to pass on the correct information!

thank you, it works, but when instigator is standing still only
if instigator is moving, he’s not ignored

btw, how to expand this case and ignore not just an instigator, but own team?