I have a c++ function that fires after my flying Actor achieves a ‘destruction’ condition.
It turns on ‘Simulate Physics’ and changes the Trace Responses + Object Type of the actor’s skeletal mesh so that it plummets to the ground like a dead weight.
When I test this c++ function in a blueprint, the collision settings don’t take effect.
/*.h*/
UFUNCTION(BlueprintCallable, Category = "Enemy")
void Destruction();
/*.cpp*/
void AEnemy::Destruction()
{
EnemySkelMesh->BodyInstance.SetObjectType(ECC_PhysicsBody);
EnemySkelMesh->BodyInstance.SetResponseToChannel(ECC_WorldStatic, ECR_Block);
AController* EnemyController = this->GetController();
if (EnemyController)
{
EnemyController->UnPossess();
EnemySkelMesh->SetSimulatePhysics(true);
}
}
I’ve managed to implement a workaround where I set the actor’s Skeletal Mesh to Block All WorldStatic in its constructor but this bug was driving me insane at first as I initially thought there was something wrong with my code.