Hi guys!
I tried for the last few hours but I can’t get this to work.
So I have a DestructibleActor which gets hit by another actor. The other actor then inflicts damage to the DestructibleActor which then breaks. Everything fine so far.
Now to the problem:
When I shoot again at the same position, the OnHit gets triggered again because there’s some leftover collision from the Destructible Actor.
How do I disable any collision (except worldstatic for the debris to not fall through the world) after the DestructibleActor has been hit once?
Here’s the code I’m currently using.
void ASpellPrototype::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
ADestructibleActor* pDestructible = Cast<ADestructibleActor>(OtherActor);
if (pDestructible)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, "Hit Destructible");
pDestructible->GetDestructibleComponent()->ApplyRadiusDamage(20.f, pDestructible->GetActorLocation(), 15.f, 50.f, true);
collisionComp->DestroyComponent();
projectileMovement->DestroyComponent();
explosion->ActivateSystem();
}
[...]
Which option did I miss? What function call did I miss?
The problem is the same even if I call
pDestructible->SetActorEnableCollision(false);
on the DestructibleActor.
I also tried to set the “Large Chunk Threshold” to a very high value which should disable collision on the debris but it doesn’t. (Read about that in another thread)
Every solution from BP to C++ is welcome.
Thanks for your time and help!