Hello.
I’m trying to make a laser gun using line trace. I’m spawning particles at the impact point of it and I wanted to add a beam emitter going all the way from the gun to the impact point.
For spawning the particles I used this:
UGameplayStatics::SpawnEmitterAtLocation(World, ImpactParticleSystem, FireHit.ImpactPoint)
Then for setting my target and source I tried this:
UParticleSystemComponent* ImpactParticle = UGameplayStatics::SpawnEmitterAtLocation(World, ImpactParticleSystem, FireHit.ImpactPoint);
ImpactParticle->SetBeamSourcePoint(2, PlayerCamera->GetComponentLocation(), 1);
ImpactParticle->SetBeamTargetPoint(2, FireHit.ImpactPoint, 1);
But it didn’t work.
i think that the particle emitter is spawning before the code is setting the source and the target of the beam.
I know, that there’s a way to do this, but I’ve been searching for it for 2 days and I still cannot find an answer.
Here’s my particle system, it may be useful.
I will be very happy if you’ll help me