Set beam souce and target vector particle parameter dynamically in code

Hello there,

I am trying to set the source and target vector particle parameter of my beam particle but something is not working properly.

Here is my particle:

And here is my current code:



FVector SourceParam;
FRotator Rotation;
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(OUT SourceParam, OUT Rotation);
    
    
FVector TargetParam = Location + Rotation.Vector() * 500.f;
ParticleSystemComponent->SetVectorParameter(FName(TEXT("BeamSource")), SourceParam);
ParticleSystemComponent->SetVectorParameter(FName(TEXT("BeamTarget")), TargetParam);


I am definitely doing something wrong, maybe using the wrong API for the ParticleSystemComponent, because I draw a debug line using that SourceParam and TargetParam and is totally different, any clues on this issue?

Thanks!

Just for further reference, here it is the solution:


FVector Location;
FRotator Rotation;
GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint(OUT Location, OUT Rotation);
            
            
FVector TargetParam = Location + Rotation.Vector() * 500.f; 
ParticleSystemComponent->Activate();
ParticleSystemComponent->SetBeamSourcePoint(0, Location, 0);
ParticleSystemComponent->SetBeamTargetPoint(0, TargetParam, 0);

I would prefer to get the emitter index by the Emitter name inside my partile instead of using hardcoded the index 0 ( the same for source index / target index ), but I guess that’s not possible in cascade? Correct me if I am wrong.