Download

How do you set a Beam's length?

I’m attempting to find out how to set the length/distance of a Beam particle system in code, but all I’m finding is hundreds of answers on how to set target positions or target actors in Blueprint, etc.

I just want to be able to set the value shown in this snapshot:

a2adce9061165548fc0cd05b94e97245e432b985.png

How to Set Particle Parameters In UE4 C++


**In Cascade **

Click on "Distribution Float Constant" (pic above as reference)

Select "**Distribution Float Particle Parameter**"

You can do this with most parameters in Cascade to then set them via code!


Give your parameter a name and default value (the constant), all within Cascade itself.

In C++

Now, in C++, after spawning your UParticleSystemComponent* via UGameplayStatics::Spawn Emitter, or some other method,

you can do this

YourPSC->SetFloatParameter(“YourChosenName”, NewValue);

Note you do this to the instance of the UParticleSystem*, which is of type UParticleSystemComponent*


**Further Info**

See ParticleSystemComponent.h!



Enjoy!

:)

Rama

IT WORKS PERFECTLY!

I was apparently stumbling around in the vicinity of the answer, but just wasn’t getting there on my own :confused:

Thank you for that answer, very helpful as always.

I used this method too to make a pointer for a VR Controller - worked spot on.