Interacting Niagara with Events

Hey guys! I’ve been looking around resources about Niagara but I couldn’t find too much that answers my question and my understanding of Niagara is not good enough to achieve the effect I want.

What I would want to do is when the player/user swipes across the touch screen, a random number of particles (which takes shape of a static mesh) would fly off to the direction which the user as swiped.

If anyone could point me to the correct direction, that would be much appreciated!

You can set the Spawn Rate and Velocity (or is it called Speed?) to be linked to User Parameters, and then On Touch set the Niagara system location to where your finger is and input the parameters: Random Float in Range => Spawn Rate and swipe speed and direction => Velocity; then set the spawn rate back to 0.

Hey Tuerer,

Thank you so much for your reply! I will try this out right now and will comment again if there are any problems!

Hi Tuerer,

I’ve tried it out but with no avail. Would you be kind enough to provide me with a screen shot of the steps so I can see what I’m doing wrong?

Thanks again! Much appreciated.

I do have the touch input events settled in my project (I followed the BP from this link: How do I implement swipe in multiple directions? - Mobile - Unreal Engine Forums ).

I have already set up the Niagara systems in my project but I couldn’t see anything related to velocity in the User Parameter tab.

I’m pretty sure I’m missing something but I just dont know what it is.

Thanks for the help once again. Much appreciated!

I can try and help you with the Niagara system, but not with the touch input events; I have never worked with them.

Have you setup the Niagara system already? There a catch that you can link the values to User Parameters only in the Niagara System, and not in the Niagara Emitter. Did you manage to change the Spawn Rate and the Velocity of the particles at runtime at all?

I can show you some screenshots in about maybe 6-7 hours.

Go to the Velocity section in the modules, and click a small arrow next to it to the right. There under the User section you have to find Read From User Parameter or something like that, and when you click that, a variable will be added to the User section that’s in your screenshot.

Copy that variable’s name and then in a blueprint you can drag a pin from the referenced niagara system and type in “Set Vector3 variable”; in the node that you’ll get just paste the variable name and then you can set this parameter using any vector you want.

As for the Spawn Rate, it’s absolutely the same except you have to set not a vector3 variable, but a float variable for the Niagara System.

You have to either add the Niagara System to the level or spawn in when you touch the screen. If you decide to spawn it, make sure to either destroy it when not needed anymore or set the Spawn Rate to 0 and continue using one and the same system.

Thanks for the detailed explanation! I’ve added the velocity modules from the User section.

Though I’m not sure how I should be connecting them in the Blueprints. The only nodes I see are related to spawning the system rather than using a system which is existing already in the map.

Place it into the level and then just change its location and Spawn Rate and particles Velocity when a user swipes.

I just thought, maybe single burst will be better: you’ll only have to activate the Niagara once upon each swipe you won’t need to set Spawn Rate back to 0.

So the System aready exists in your level; on swipe, set its location to where you touch the screen, set the particles velocity based on the swipe speed/direction. The System bursts the particles once and that’s it, its still there in the level and awaits the next swipe.

Another thought I just had: you can place the Niagara System just in from of the camera for it to always be there. In the System itself set the Sphere Location (the sphere in which the particles will originate), and you can change the Sphere offset instead of changing the location of the System itself.

I see. The problem I’m having is that I would like the Niagara component to be continuous (project does not have an end) since people are just going to be interacting with this project nonstop.

How do you suggest I go about doing this?

Edit: It seems like I can’t add the Vector3 node after the “IfTrue” branch or else it will just give me a compile error.

My apologies but I’m starting to get lost.

It’s a little bit sloppy but I’ve made the system appear on the screen.

I’d assume that if I want to change the position of the system, I’d have to change the “relative transform” pin? I’m also not sure how to select random particles from the nodes.

Hi Tuerer,

Just wondering if you could provide me with the screenshots for the steps through this!

Thank you for being patient with me. :slight_smile:

Sorry, it’s just a bit difficult to do when I don’t know what exactly you want it to look like.

What is the actor you’re creating the Niagara component in? I just had assumed it would be a separate actor in the level. Do you have a 2D or 2.5D or 3D project? Do you want your particle effect to have volume or to just exist in the screen plane?

What I thought of was this: attach the Niagara actor to your camera, right in front of it. In the system itself in the Particle Spawn section add a Sphere Location module, set its radius to whatever suits you, and set the Local Offset to Read from User Parameter.

When you swipe the screen you can set this Offset Parameter to any value depending on the finger position on the screen. Thus you won’t move the Niagara System, you will only move the origin of the particles.

As for the random number, here:

267866-sphereloc.png

Just don’t forget to connect the Niagara to the Set Variable node, because you didn’t connect it to the Velocity.

I really appreciate the reply.

Perhaps I should describe further what I would want to do. I would want the Niagara system to follow a spline which is a closed loop. You can think of something like a snake which has particles around it and will move in all axis. After a person swipes across the screen, the particles will “die” and disappear to the direction of the swipe. The particles will follow a static mesh (the snake’s head is a static mesh while the body is a niagara system).

This Niagara component will be on the level blueprint as the swipe gesture logic is there and I would like the entire system to be displayed on the server.

Hope this clarifies some of the things! (Thank you for being patient with me. I have little no experience with Niagara, let alone UE4)

Edit: The camera viewing this action will be stationary.

This is how the level looks like currently!

Hey Tuerer. Sorry for bugging you so much regarding this. I have implemented the sphere offset in the Niagara systems and put them in the level blueprint.

The start and end vector both can be accessed through the nodes “Touch Start 2D Vector” and “Touch End 2D Vector” in the blueprint. I’d assume that one of the pins would have to take both inputs but I’m not sure which one will do so.

So if I get it right: the snake head moves and leaves behind some particles that stay in place, but when you swipe across them, they start miving in the swipe direction. Not all of them, but only a portion that was touched, right?

If so, that would be a bit trickier. You have to set velocity to 0 in the Particle Spawn section, but work with the Particle Update section instead. If you want to apply force locally to a portion of perticles, you’ll maybe have to use some kind of attraction/pushing and change its force/radius/location.

You are correct except that it doesn’t have to be the portion that was touched when the user swipes the screen. I can just be any particle in the system. The user doesn’t necessarily have to touch the particle itself.

I’ve set the velocity in the Particle Spawn section to 0. I’d assume that I’ll have to select a random number of particles in the Particle Update section (because it doens’t matter if the user has touched them or not), and use velocity to determine which direction the player has swiped?