#include "Kismet/GameplayStatics.h"
#include "Particles/ParticleSystem.h"
#include "Particles/ParticleSystemComponent.h"
#include "Components/SkeletalMeshComponent.h"
//生成特效
(1)
//参数 特效,附到哪个组件,插槽的名字
UGameplayStatics::SpawnEmitterAttached(MuzzleEffect, SkeletalMeshComponent, MuzzleSocketName);
(2)
UGameplayStatics::SpawnEmitterAtLocation(GetWorld(),ImpactEffect, OutHit.ImpactPoint,OutHit.ImpactNormal.Rotation());
(3)
if (TraceEffect)
{
FVector MuzzleLocation = SkeletalMeshComponent->GetSocketLocation(MuzzleSocketName);
UParticleSystemComponent* TraceComp= UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), TraceEffect, MuzzleLocation);
if (TraceComp)
{
//根据粒子的Target组件的参数属性的值 设置 粒子的终点
TraceComp->SetVectorParameter("BeamEnd",TractorEndPoint);
}
}