I’m trying to get a destructable actor to explode using RadialForceActor. This works… but not on the initial trigger.
The first impulse fractures the mesh slightly, subsequent impulse actually push it like how I want. No matter what I do to the settings, the first “breaking” impulse is always going to not have the effects I need. Here’s my code:
void AProjectile::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
if (ImpactTemplate)
{
AImpactEffect* EffectActor = GetWorld()->SpawnActorDeferred<AImpactEffect>(ImpactTemplate, Hit.ImpactPoint, Hit.ImpactNormal.Rotation());
if (EffectActor)
{
EffectActor->SurfaceHit = Hit;
UGameplayStatics::FinishSpawningActor(EffectActor, FTransform(Hit.ImpactNormal.Rotation(), Hit.ImpactPoint));
}
}
if (OtherActor)
{
ARadialForceActor* ForceActor = GetWorld()->SpawnActorDeferred<ARadialForceActor>(ForceTemplate, Hit.ImpactPoint, Hit.ImpactNormal.Rotation());
if (ForceActor)
{
UGameplayStatics::FinishSpawningActor(ForceActor, FTransform(Hit.ImpactNormal.Rotation(), Hit.ImpactPoint));
ForceActor->FireImpulse();
ForceActor->Destroy();
}
}
Destroy();
}
Is this related to this question here?
Do I have to spawn 2 impulses with a delay?