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
//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