Hi,
I have implemented damaging actors hit by destructible chunks by a hit event, but afterwards I want to avoid to damage actors moving into the stationary chunks.
Any idea how to get chunk ID from hit information? Then I can determine chunk speed to disable damage.
Thanks.
ho-ho-ho, problem solved, crazy workaround used of course
I’m having a similar issue, can you share your solution?
hi,
I use these functions to stop simulation, and reset collision:
void ARTSBuilding::FinishDestroyRTSEntity()
{
Multicast_FinishDestroyRTSBuilding();
Super::FinishDestroyRTSEntity();
}
void ARTSBuilding::Multicast_FinishDestroyRTSBuilding_Implementation()
{
for (auto DestructibleMeshComponent : DestructibleMeshes)
{
// some small chunks stay stationary somehow…
DestructibleMeshComponent->SetSimulatePhysics(false);
// to deny collision with land and terrain
DestructibleMeshComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
DestructibleMeshComponent->SetCollisionProfileName(TEXT("NoCollision"));
#if WITH_APEX
// from DestructibleMeshComponent->SetSimulatePhysics() false section - works!
PxRigidDynamic** PActorBuffer = NULL;
PxU32 PActorCount = 0;
if (DestructibleMeshComponent->ApexDestructibleActor->acquirePhysXActorBuffer(PActorBuffer, PActorCount))
{
for (uint32 ActorIdx = 0; ActorIdx < PActorCount; ++ActorIdx)
{
PxRigidDynamic* PActor = PActorBuffer[ActorIdx];
if (FApexDestructionCustomPayload* ChunkInfo = (FApexDestructionCustomPayload*)FPhysxUserData::Get<FCustomPhysXPayload>(PActor->userData))
{
DestructibleMeshComponent->ApexDestructibleActor->setChunkPhysXActorAwakeState(ChunkInfo->ChunkIndex, true);
}
}
DestructibleMeshComponent->ApexDestructibleActor->releasePhysXActorBuffer();
}
#endif
}
}