Download

How to extract data from a particle using Particle Export Data?

ello guys!

I was looking for a way to code the extraction of my Niagara System particles data using Particle Export Data and make it work.

You see, I created a Niagara Modular Script and inside I have used, in the Map Get, a Particle Export Data, in addition to a Store Particle Data node. But I can only store particles data such as particles position, size and velocity. I can’t store parameters like Lifetime, SpriteFacing, SpriteAlignment, Gravity Force Vector, etc. Here is the Niagara Module Script:

https://preview.redd.it/gyp6pchgqcj61.png?width=1920

And here is a image of my Niagara System setup:

https://preview.redd.it/s1r4kj3zqcj61.png?width=1920

My AActor class is inheriting INiagaraParticleCallbackHandler and implementing the both the UNiagaraComponent::SetNiagaraVariableObject and the INiagaraParticleCallbackHandler::ReceiveParticleData method. Accessing FBasicParticleData members only shows particles Position, Size and Velocity, the rest are irrelevant.

https://preview.redd.it/6tdi9ca4scj61.png?width=1920

https://preview.redd.it/lo2ows4utcj61.png?width=1920

https://preview.redd.it/cwmoxs6rucj61.png?width=1920

I mean, I want to get some information, coding, from my Niagara System, like Lifetime, SpriteAlignment Vector, etc., multiply them by a value stored in a variable and use the UNiagaraComponent::SetFloatParameter to reconfigure the system, it’s that so complicated to do? Niagara’s documentation is laughable, is lacking a lot of things.

Based on the NiagaraDataInterfaceExport.h, what should modify, besides that FbasicParticledata struct? Or is there any other option to retrieve such data?

Thanks! :slight_smile:

PS: EPIC, your documentation sucks!!!

You do have a pointer to the underlying NiagaraSystem. You can probably do something like the code block below to access the parameters. I haven’t worked with Niagara much though and even the times that I have it has only been through the editor so I might be way off.


TArray<FNiagaraVariable> OutParameters;
float LifetimeParameterValue = -1;

NiagaraSystem->GetExposedParameters()->GetUserParameters(OutParameters);
for(FNiagaraVariable Parameter : OutParameters){
    if(Parameter.GetName() == FName("PEN_BlackHole_Lifetime")){
        LifetimeParameterValue = Parameter.GetValue<float>();
    }
}

Thanks for your reply. I was reading both the UNiagaraSystem and the GetExposedParameters() documentation, and I was thinking about something like you did. By the way, do you know a way to extract a module data from a Niagara System/Component?