How do you spawn an emitter at a collision location?

Ok, so I’d like a particle system to spawn based on the collision of two meshes. Is there a way to tell UE4 to find this collision location and spawn the emitter there?

Hi NullFX -

I made the assumption that you two meshes are physics based collisions, so if that is not true let me know, but here is the best way I could find with an Event OnActorHit >> Break Hit Result, impact point >> location, Make Transform, return value >> relative Transform Add Particle System. Here is a screenshot of the blueprint:

The DoOnce node is in there to keep the bounce of my physics object from spawning two systems.

Thank You

Eric Ketchum

It won’t be two physics based actors. One will hopefully be like a melee swing or projectile attack from a character and the other will be a static mesh in the scene with colliders attached to it.

Hey NullFX -

Even easier, in either case you will be calling an Event Hit and you can add in a Spawn Emitter based on the location of the Event Hit call. Here is the setup based on the first person blueprint template, it is assigned in that template to the My Projectile Blueprint. You will want to make sure that whatever particle system you are generating is finite in length and not infinitely looping because then the emitter will exist forever (unless that’s what you want in which case there you go.)

That works wonderfully, the only problem is that it’s spawning the particles regardless of what it’s colliding with. Is there a way to make it only fire if it hits a certain mesh?

You can do a Branch based on the specific material that the object has assigned. Again this blueprint is from My Projectile and the 1st person template, you will need to assign a new material to all objects (including all sides of the Geometry brushes) and make sure you have the material of the object you want to spawn emitters assigned in the blueprint.

Eric Ketchum

Sounds easy enough. What function is the “= =” that connects to the branch and is there anything important going on farther off to the right?

the “==” function you can use when you pull a actor line in event graph and tap “=” key…this is a great function and will see if the object from one input is equal to the other below…if is…the bool connected in Branch will be true…if is not…false…

I don’t think is there anything to the right side much important…because your primal question only reach to that point…

Hi NullFX -

Sand is right the only thing to the right of the image I posted was the turn into Physics Objects stuff from the original Blueprints I just moved it over to let you see the layout of the new nodes.

Enjoy

Eric Ketchum

I’m not understanding where it’s pulling the external material reference from…When I put all of that in it doesn’t spawn the particles with any collision at all. Here’s what I have going so far.

Hi NullFX -

Ok so you are doing a check of the material that is set on the object your projectile is hitting and comparing (==) it with a specific Material. Since the comparison likes to look at Base Materials and not Material Instances, that is the Get Base Material node. In the comparison you should be choosing the Base Material for the object(s) you want to hit.

Always remember too that using a print string and playing in editor will allow you to see exactly what a particular node is returning, so in your example hook up a print string to the Output of Get Base Material and have the string print the return value. What it returns is what you should be comparing to in the == node.

On a side note, I would also hook up your false node from the 1st Branch your sequence to the input of the second branch that way your particles will still be destroyed, otherwise you will have a large amount of particles just lying around.

Hope that explains things a little better -

Eric Ketchum

Fantastic! Everything is working correctly. As it turns out for some reason the base texture is stored in two different folders and I was using the one in the wrong folder (Not sure why it’s saved twice). Thanks for all the help!