Pure Virtual Function used in engine source? PxU32 FilterFlags0 = Shape0->getSimulationFilterData().word3 & 0xFFFFFF reading 0x0 in BodyInstance.cpp

Update: I’ve found the precise line that it is failing on:

PxU32 FilterFlags0 = Shape0->getSimulationFilterData().word3 & 0xFFFFFF;

Does anyone have an idea why it would be reading a null address here?

I’ve also found a related post here:

But the null value is read before it reaches the fix suggested there.

In the PhysX documentation it says this a pure virtual function… am I missing something?

EndUpdate

AddRelativeRotation and SetRelativeRotation (for component rotations) are crashing when the owning actor is simulating physics.

I get the following error when my tank turret and barrel are rotating to aim at a position:

[2017.08.09-20.19.41:487][465]LogOutputDevice:Error: Ensure condition failed: OutTM.isValid() [File:/Users/build/Build/++UE4+Release-4.16+Compile/Sync/Engine/Source/Runtime/Engine/Private/PhysicsEngine/BodySetup.cpp] [Line: 541]
[2017.08.09-20.19.41:487][465]LogStats: FDebug::EnsureFailed -  0.000 s

What’s even stranger, I can only get the error to occur if my tank is not touching the ground.

It does appear that I can continue from the breakpoint without any apparent problems.

However, when the wheels of my tank come into contact with the ground and a nonzero rotation is being applied to them every tick (they are spinning) the editor crashes with error:

error: memory read failed for 0x0

It seems I’m getting a null pointer somewhere in the collision code. Any ideas?

The last function call before reading 0x0 was FBodyInstance::AddCollisionNotifyInfo. Here is the full backtrace:

* thread #6, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x0000000000000000
    frame #1: 0x000000010351b1da UE4Editor-Engine.dylib`FBodyInstance::AddCollisionNotifyInfo(FBodyInstance const*, FBodyInstance const*, physx::PxContactPair const*, unsigned int, TArray<FCollisionNotifyInfo, FDefaultAllocator>&) + 1482
    frame #2: 0x00000001035f7d73 UE4Editor-Engine.dylib`FPhysXSimEventCallback::onContact(physx::PxContactPairHeader const&, physx::PxContactPair const*, unsigned int) + 771
    frame #3: 0x000000010bed878b libPhysX3PROFILE.dylib`physx::Sc::Scene::fireQueuedContactCallbacks(bool) + 267
    frame #4: 0x000000010bd6d97c libPhysX3PROFILE.dylib`physx::NpScene::fetchResults(bool, unsigned int*) + 348
    frame #5: 0x000000010dcdfe54 libApexFrameworkPROFILE.dylib`nvidia::apex::ApexScene::fetchResults(bool, unsigned int*) + 532
    frame #6: 0x00000001035c9ac2 UE4Editor-Engine.dylib`FPhysScene::ProcessPhysScene(unsigned int) + 3858
    frame #7: 0x00000001035e24a7 UE4Editor-Engine.dylib`TBaseRawMethodDelegateInstance<false, FPhysScene, void (ENamedThreads::Type, TRefCountPtr<FGraphEvent> const&), EPhysicsSceneType>::ExecuteIfSafe(ENamedThreads::Type, TRefCountPtr<FGraphEvent> const&) const + 39
    frame #8: 0x0000000102ebc438 UE4Editor-Engine.dylib`TGraphTask<FDelegateGraphTask>::ExecuteTask(TArray<FBaseGraphTask*, FDefaultAllocator>&, ENamedThreads::Type) + 600
    frame #9: 0x00000001001ec1cf UE4Editor-Core.dylib`FNamedTaskThread::ProcessTasksNamedThread(int, bool) + 1327
    frame #10: 0x00000001001eb627 UE4Editor-Core.dylib`FNamedTaskThread::ProcessTasksUntilIdle(int) + 679
    frame #11: 0x00000001001e6cb1 UE4Editor-Core.dylib`FTaskGraphImplementation::ProcessThreadUntilIdle(ENamedThreads::Type) + 641
    frame #12: 0x0000000103b60c61 UE4Editor-Engine.dylib`FTickTaskSequencer::ReleaseTickGroup(ETickingGroup, bool) + 3281
    frame #13: 0x0000000103b582d4 UE4Editor-Engine.dylib`FTickTaskManager::RunTickGroup(ETickingGroup, bool) + 644
    frame #14: 0x000000010303563b UE4Editor-Engine.dylib`UWorld::RunTickGroup(ETickingGroup, bool) + 347
    frame #15: 0x000000010303ff38 UE4Editor-Engine.dylib`UWorld::Tick(ELevelTick, float) + 10168
    frame #16: 0x0000000108c7eef8 UE4Editor-UnrealEd.dylib`UEditorEngine::Tick(float, bool) + 7752
    frame #17: 0x000000010995e28c UE4Editor-UnrealEd.dylib`UUnrealEdEngine::Tick(float, bool) + 28
    frame #18: 0x000000010001de75 UE4Editor`FEngineLoop::Tick() + 16037
    frame #19: 0x0000000100025c22 UE4Editor`GuardedMain(wchar_t const*) + 850
    frame #20: 0x000000010003359a UE4Editor`-[UE4AppDelegate runGameThread:] + 218
    frame #21: 0x000000010039be86 UE4Editor-Core.dylib`-[FCocoaGameThread main] + 134
    frame #22: 0x00007fffad2f9b3d Foundation`__NSThread__start__ + 1243
    frame #23: 0x000000010b263b90 libsystem_pthread.dylib`_pthread_body + 180
    frame #24: 0x000000010b263adc libsystem_pthread.dylib`_pthread_start + 286
    frame #25: 0x000000010b2632c5 libsystem_pthread.dylib`thread_start + 13

I made of the copy of the project to run on the new 4.17 release and I’m now encountering a failed “ensure” on the wheels that I used to encounter on the tank turret and barrel. The ensure says that OutTM.isValid() is failing in BodySetup.cpp. I’m going to post another question in case this is a separate issue.