DestructibleComponent does not respect calls to UPrimitiveComponent::SetCollisionEnabled or AActor::SetActorEnableCollision at runtime
I am encountering the following issue:
Expected result: at steps 3 and 5, the actor should not have collision
Note: The delay is not necessary for the repro, it just simulates behaviour that we want to trigger during gameplay.
This bug is because the two functions used access UPrimitiveComponent::BodyInstance directly, but for DestructibleComponents, this variable is unused. Instead, either the two functions should call GetBodyInstance(). I posted about this discrepancy before: why is there a virtual GetBodyInstance() function that isn't called by most functions in PrimitiveComponentPhysics.cpp?
Regarding SetActorEnableCollision, the bug is due to this function:
The BodyInstance is not a valid body, so nothing happens. UDestructibleComponent should probably override OnActorEnableCollisionChanged and iterate over all it's BodyInstances.
Regarding SetCollisionEnabled, the bug is due to this function:
Again, BodyInstance is not a valid body, so nothing happens. UDestructibleComponent should probably override this function in a way similar to USkeletalMeshComponent::SetCollisionEnabled.
asked Jan 02 '16 at 07:14 PM in Bug Reports
I have reproduced the behavior on my end and have entered a bug report (UE-24868) for investigation. For now, you can use the following as a workaround. If you add a static mesh to the blueprint with the destructible mesh and set the static mesh to the same mesh as the DM, both the static mesh and DM will have their collision disabled.
answered Jan 04 '16 at 04:03 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here