Spawn Particle System at Impact Point on a static object
This commit is contained in:
parent
b4fb8f7761
commit
ca617a8a3c
|
@ -396,6 +396,19 @@ void APlayerCharacter::ProcessHits(TArray<FHitResult> hits)
|
|||
rot.Yaw += 180.0f;
|
||||
decalActor->SetActorRotation(rot);
|
||||
}
|
||||
|
||||
if (staticMeshComponent && !staticMeshComponent->IsSimulatingPhysics() &&
|
||||
CurrentWeapon->GetImpactParticleSystem())
|
||||
{
|
||||
FTransform transform;
|
||||
transform.SetLocation(Hit.ImpactPoint);
|
||||
|
||||
UGameplayStatics::SpawnEmitterAtLocation(this,
|
||||
CurrentWeapon->GetImpactParticleSystem(),
|
||||
transform.GetLocation(),
|
||||
FRotator::ZeroRotator,
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,6 +125,11 @@ TSubclassOf<ADecalActor> AWeapon::GetDecalActor()
|
|||
return DecalActor;
|
||||
}
|
||||
|
||||
UParticleSystem* AWeapon::GetImpactParticleSystem()
|
||||
{
|
||||
return ImpactParticleSystem;
|
||||
}
|
||||
|
||||
TSubclassOf<class ANakatomiFieldSystemActor> AWeapon::GetFieldSystemActor()
|
||||
{
|
||||
return FieldSystemActor;
|
||||
|
|
|
@ -55,6 +55,9 @@ protected:
|
|||
UPROPERTY(EditDefaultsOnly)
|
||||
TSubclassOf<class ADecalActor> DecalActor;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
UParticleSystem* ImpactParticleSystem;
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AWeapon();
|
||||
|
@ -101,4 +104,6 @@ public:
|
|||
TSubclassOf<AWeaponThrowable> GetWeaponThrowableTemplate();
|
||||
|
||||
TSubclassOf<class ADecalActor> GetDecalActor();
|
||||
|
||||
UParticleSystem* GetImpactParticleSystem();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue