Engine crashes when SetCollisionResponseToChannel on destructable mesh

Hello,

I am currently developing an object pickup system and found probably a bug. Whenever I pick up a destructable mesh and destruct it by smashing it against a wall etc. while holding it (rotating camera fast so that the object is crashing onto the wall) the engine crashes. The error occurs on the call SetCollisionResponseToChannel on the destructable mesh component.
The code segment this occurs:

void Character::EndObserving()
{
	if (!bObservingActive) return;
	bObservingActive= false;
	
	PhysicsHandleLoc->ReleaseComponent();
	PhysicsHandleRot->ReleaseComponent();

	if (ObservComponent.IsValid())
	{
		ObservComponent->SetCollisionResponseToChannel(ECC_Pawn, ECR_Block); //Error occurs here with a destructable mesh component
		ObservComponent->WakeAllRigidBodies();
		ObservComponent->SetEnableGravity(true);

		if (bShouldThrow)
		{
			FVector camLocation = FirstPersonCameraComponent->GetForwardVector();
			camLocation *= ObservComponent->GetMass() * ThrowStrength;
			ObservComponent->AddImpulse(camLocation);
		}
	}

}

Crash report:

MachineId:3F8F4932429CF8C9B7B82EAFE18495B5
EpicAccountId:ecd415371e454ee0b59755727916a58a

Access violation - code c0000005 (first/second chance not available)

UE4Editor_Engine!FBodyInstance::GetAllShapes_AssumesLocked() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\physicsengine\bodyinstance.cpp:359]
UE4Editor_Engine!<lambda_1f56e30ea1864c98ea4370aeb6c42cab>::operator()() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\physicsengine\bodyinstance.cpp:720]
UE4Editor_Engine!FBodyInstance::ExecuteOnPhysicsReadWrite() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\physicsengine\bodyinstance.cpp:2984]
UE4Editor_Engine!FBodyInstance::UpdatePhysicsShapeFilterData() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\physicsengine\bodyinstance.cpp:856]
UE4Editor_Engine!FBodyInstance::UpdatePhysicsFilterData() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\physicsengine\bodyinstance.cpp:1006]
UE4Editor_Engine!UPrimitiveComponent::SetCollisionResponseToChannel() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\primitivecomponentphysics.cpp:944]
UE4Editor_NoEndHouse_4976!ANoEndHouseCharacter::EndObserving() [d:\eigene dateien\programmieren\ue4\noendhouse 4.11\source\noendhouse\noendhousecharacter.cpp:532]
UE4Editor_NoEndHouse_4976!ANoEndHouseCharacter::Tick() [d:\eigene dateien\programmieren\ue4\noendhouse 4.11\source\noendhouse\noendhousecharacter.cpp:597]
UE4Editor_Engine!AActor::TickActor() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\actor.cpp:787]
UE4Editor_Engine!FActorTickFunction::ExecuteTick() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\actor.cpp:110]
UE4Editor_Engine!FTickFunctionTask::DoTask() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\ticktaskmanager.cpp:228]
UE4Editor_Engine!TGraphTask<FTickFunctionTask>::ExecuteTask() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\public\async\taskgraphinterfaces.h:886]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\private\async\taskgraph.cpp:779]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\private\async\taskgraph.cpp:526]
UE4Editor_Core!FTaskGraphImplementation::WaitUntilTasksComplete() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\private\async\taskgraph.cpp:1534]
UE4Editor_Engine!FTickTaskSequencer::ReleaseTickGroup() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\ticktaskmanager.cpp:486]
UE4Editor_Engine!FTickTaskManager::RunTickGroup() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\ticktaskmanager.cpp:1373]
UE4Editor_Engine!UWorld::RunTickGroup() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\leveltick.cpp:702]
UE4Editor_Engine!UWorld::Tick() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\leveltick.cpp:1187]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\editor\unrealed\private\editorengine.cpp:1356]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\editor\unrealed\private\unrealedengine.cpp:370]
UE4Editor!FEngineLoop::Tick() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\launch\private\launchengineloop.cpp:2643]
UE4Editor!GuardedMain() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\launch\private\launch.cpp:142]
UE4Editor!GuardedMainWrapper() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\launch\private\windows\launchwindows.cpp:200]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:264]
kernel32
ntdll

Am I handling the destructable mesh component incorrectly or is this a bug?

So, I couldn’t find documentation on this and also haven’t encountered this case personally, but I believe that the base destructible object is destroyed when it is fractured, making previous references to it liable to throw null pointer access violations. I’m not in front of my project at the moment, and can’t try this myself, so keep my first disclaimer in mind.

Yes, I also though about this. I am currently debugging further and try to determine the specific part the access violation is caused by. So far the destructable component looks intact, but maybe I can workaround it completely by using the OnActorFracture and then just “detach” from the destructable mesh.

Hello ,

I haven’t had much of a chance to look at this as of yet but I wanted to let you know that I’m investigating the issue. I believe KingCole32 is on the right track about the null references but I can’t confirm as of yet.

Hello ,

If you have the time, would it be possible for you to provide a sample project where this issue reproduces? While looking into the problem, I’ve been having trouble getting the crash to occur for me which heavily impedes progress.

We haven’t heard from you in a while, . Are you still experiencing this issue? If so, have you had a chance to put together a sample project that reproduces the issue? In the meantime, I’ll be marking this issue as resolved for tracking purposes. Please leave a comment when you’re available and the post will reopen.