I’m making a particle emitter with a “Point Attraction Force” for which the attraction position should be a global variable that I can change in C++.
- I’ve made a niagara parameter collection and added a vector to it
- Added the collection parameter to the emitter
- And referenced the parameter to the attraction position inside the “Point Attraction Force”
- Inside player actor; I update the variable with the code below
TArray<FNiagaraVariable>& parameters = mNiagaraParameterCollection->GetParameters();
parameters[0].SetValue<FNiagaraPosition>(GetActorLocation());
or via a parameter collection instance.
mNiagaraParameterCollectionInstance->SetVectorParameter(TEXT("Location"), GetActorLocation());
For whatever reason the parameter won’t update when I spawn systems with those emitters. The attraction force is working but it seems like it is using a zero vector, which is the default value inside the parameter collection.