void FApexChunkReport::onStateChangeNotify(const apex::ChunkStateEventData& visibilityEvent) { UDestructibleComponent* DestructibleComponent = Cast<UDestructibleComponent>(FPhysxUserData::Get<UPrimitiveComponent>(visibilityEvent.destructible->userData)); check(DestructibleComponent); if (DestructibleComponent->IsPendingKill()) //don't notify if object is being destroyed { return; } DestructibleComponent->OnVisibilityEvent(visibilityEvent); }
void FApexChunkReport::onDamageNotify(const apex::DamageEventReportData& damageEvent) { UDestructibleComponent* DestructibleComponent = Cast<UDestructibleComponent>(FPhysxUserData::Get<UPrimitiveComponent>(damageEvent.destructible->userData)); check(DestructibleComponent); if (DestructibleComponent->IsPendingKill()) //don't notify if object is being destroyed { return; } DestructibleComponent->GetWorld()->GetPhysicsScene()->AddPendingDamageEvent(DestructibleComponent, damageEvent); }