Line Trace On-Hit Effects

RESOLVED

So some of you may be aware that line tracing can spawn emitters at the end of the trace, or at the impact point of collision with a static/dynamic object.

My current issue is that I am working on an FPS game and I cannot for the life of me figure out how to make the emitter effect CHANGE dependent on the material/surface it hits.

I haven’t really tried more than one surface so far, and the complicated part is that the surface happens to be a skeletal mesh of an AI actor. I want it to be the default emitter spawn is (we’ll call it) “ricochet” particle effect. When it hits this humanoid AI I want it to spawn the “bloodsplat” particle effect instead, but as soon as I shoot anywhere else that has no set particle effect, I want it to revert to the default “ricochet” effect.

How can I go about doing this? I am looking particularly for line-trace emitter spawning. I was thinking there might be a way to use a boolean and a branch to make an if/then statement about if the trace hit is on an actor or an AI / group / class of actors … THEN convert the particle into blood…

But my problem is I don’t know how I would BP a line trace registration with specific objects. Any thoughts?


RESOLVED:

I have found a function in my line trace blueprinting that allowed me to select the surfaces. It was right under my nose for hours! I took the hit result and converted two selector nodes into a sound selector and an emitter selector based on the return value of the PhysMat pin (from Break Hit Result on the Line Trace) which I had run a check on the target surface type, and plugged it into the index of the emitter’s selector node, and assigned my specific physical materials with their own custom emitter and SFX.

The only issue I find immediately noticeable with this solution is that the function could end up becoming player specific based off of MY blueprints. But for everyone else this shouldn’t be an issue. My next task is to test assigning a physical material to the material used on my AI’s skeletal mesh and see if my hit result comes out true for impact on specified surfaces and hopefully returns the appropriate SFX and particle emission.


:slight_smile:

1 Like