[4.3 Destructibles] [Easy Repro in BP] When Destructible spawned in code and damage applied immediately, it disappears. When using delayed timer, resultant collision of pieces does not look right at all

Dear Friends at Epic,

During the Beta I spawned destructible meshes in code and blew them up and collision of the pieces was perfect and no delay was required after spawning before blowing them up.

In 4.0 I made my own destructible actor class and everything worked perfectly.

now in 4.3, when I spawn even the base Destructible Actor class, if I try to destroy it immediately, it simply disappears.

So I am forced to use a delayed timer to then destroy them a moment after spawning them!

Also, when the destructibles do blow up, the pieces have very strange collision.

It looks like they all have sphere collision, pieces will hover above ground, pieces will go through each other, it looks very bad.

When I take a destructible actor and apply my same asset in the editor, drag it into world, and then destroy it on key press during runtime it works perfectly!

#Repro

  • Spawn a Destructible Actor during runtime, set its component, and then blow it up all in same tick
  • When I do this in C++ I get the strange behavior mentioned, the mesh simply disappears

#Repro 2

-Spawn a destructible actor, set its component, and then use a delayed timer of 0.1 seconds, and then blow it up
-when I do this in C++ I get a very bad looking destructible effect where the pieces go through each other and seem to all be spheres, the collision does not look right and is not precise at all.

#BP Repro Works

You can repro this in the editor!

Make a Destructible Actor BP, set the destructible asset to something

then place an instance of the BP in world

in level blueprint, destroy the one that you placed in world, and at the same time, spawn a new instance from the same BP, and make it appear 64 units or 256 units above the first one.

destroy the spawned one in the same instant that you spawn it, and destroy the other one

so this all happens on 1 key press

you will find that the collision of the one that is placed in the world is perfect,

but the one that was spawned will not look right, some pieces will roll around as if they have sphere colliision, and also go through the floor sometimes!

Here’s a picture:

#Scaling

I think its related to scaling, make sure to rescale the apex 3 times bigger to ensure repro of this issue

#Code

//spawn Apex!
	//Spawn info
	FActorSpawnParameters SpawnInfo;
	SpawnInfo.bNoCollisionFail 		= true;
	SpawnInfo.Owner 				= this;
	SpawnInfo.bDeferConstruction 	= false; //do NOT defer construction
	
	TestDestruct = 
		GetWorld()->SpawnActor<ADestructibleActor>(
			ADestructibleActor::StaticClass(), 
			NewApexInfo.Location,
			NewApexInfo.Rotation, 
			SpawnInfo 
	); 
	 
	TestDestruct->DestructibleComponent->SetDestructibleMesh(VictoryPC->ApexHover);
	TestDestruct->DestructibleComponent->SetRelativeScale3D(FVector(3));
	GetWorldTimerManager().SetTimer(this, 
		&AJoyShapesCharacterBase::DestructTimerTest, 1, false);

void AJoyShapesCharacterBase::DestructTimerTest()
{
	TestDestruct->DestructibleComponent->ApplyDamage(500,TestDestruct->DestructibleComponent->GetComponentLocation(),FVector(0,0,1),10);

}

#Scaling

I can confirm this issue only happens when there is scaling involved on the DestructibleComponent after it is spawned.

#Everything is fine if the destructible component is never scaled!

#Thanks!

Please help, thanks!

rama

I got another weird case in my scene with ~10k destructibles :wink:
When I put another one but with “simulate physics” = true this one will be destroyed without spawning chunks with strange event from APEX:
NxApexChunkFlag::DESTROYED_FIFO_FULL

and maybe this is somehow related to your problem.

https://devtalk.nvidia.com/default/topic/762226/apex/nxapexchunkflag-destroyed_fifo_full/

Nice to hear from you!

When I try to set simulate to true on spawned apex, I get a log error that there is no physics body to set simulate physics on, and also the mesh does not start simulating physics :slight_smile:

Rama

Hi

Sorry this was missed. I was just going through questions without answers and saw that we never got to this one. Could you tell me if it is still occurring? If so, I can have it investigated by one of our team.

I am going to make this an answer in case it is resolved and no longer occurs.

Thanks!

Yes it still occurs, actually in 4.5 it is worse because it happens for clients too

In 4.3 it was only the server that needed the delay, but now client needs it to as of 4.5

Some sort of physics initialization is not occurring when the destructible is first created such that I have to give it a moment before apply damage to it :slight_smile:

Hi

Thanks for the repro steps.

I was actually able to narrow it down even further to a more simple repro.

I just used a Key press for Set Actor Scale 3D and set the size via Make Vector for the new scale 3D pin.

I’ve entered the bug report for this (UE-6407).

I’ll update here once the issue has been addressed.

Thanks!

Thanks for the update !

#:heart:

Rama