Questions:
Do you know what cause this problem, or how can I move correctly these actors between the scenes?
How can I debug to get more informations?
Code explanation:
I’m using UE4 and I’m trying to replay the moves of a vehicle, for doing this I’ve created a separate PxScene.
I want to move the actors from the main scene to the new created one, in this way:
PxScene* PScene = GetWorld()->GetPhysicsScene()->GetPhysXScene(PST_Sync);
const PxU32 DynamicActorsNum = PScene->getNbActors(PxActorTypeFlag::eRIGID_DYNAMIC);
TArray<PxActor*> DynamicActors;
DynamicActors.AddUninitialized(DynamicActorsNum);
PScene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC, DynamicActors.GetData(), DynamicActorsNum);
FPhysScene* PS = new FPhysScene();
PxScene* RRPScene = PS->GetPhysXScene(PST_Sync);
PScene->removeActors(DynamicActors.GetData(), DynamicActorsNum);
RRPScene->addActors(DynamicActors.GetData(), DynamicActorsNum);
for (int32 a = 0; a < 2; ++a) {
RRPScene->simulate(1.f / 60.f);
RRPScene->fetchResults(true);
}
RRPScene->removeActors(DynamicActors.GetData(), DynamicActorsNum);
PScene->addActors(DynamicActors.GetData(), DynamicActorsNum);
delete PS;
PS = nullptr;
I get this error:
[...]
'UE4Editor.exe' (Win32): Loaded 'C:\Program Files\Nahimic\NahimicMSI\UserInterface\x64\OvlDynExt.dll'. Cannot find or open the PDB file.
'UE4Editor.exe' (Win32): Unloaded 'C:\Program Files\Nahimic\NahimicMSI\UserInterface\x64\OvlDynExt.dll'
'UE4Editor.exe' (Win32): Loaded 'C:\Windows\System32\NapiNSP.dll'. Cannot find or open the PDB file.
'UE4Editor.exe' (Win32): Loaded 'C:\Windows\System32\pnrpnsp.dll'. Cannot find or open the PDB file.
'UE4Editor.exe' (Win32): Loaded 'C:\Windows\System32\nlaapi.dll'. Cannot find or open the PDB file.
'UE4Editor.exe' (Win32): Loaded 'C:\Windows\System32\winrnr.dll'. Cannot find or open the PDB file.
The thread 0x2624 has exited with code 0 (0x0).
The thread 0x210 has exited with code 0 (0x0).
'UE4Editor.exe' (Win32): Loaded 'C:\Program Files\Nahimic\NahimicMSI\UserInterface\x64\OvlDynExt.dll'. Cannot find or open the PDB file.
'UE4Editor.exe' (Win32): Unloaded 'C:\Program Files\Nahimic\NahimicMSI\UserInterface\x64\OvlDynExt.dll'
Exception thrown at 0x00007FFFEB9772E7 (PhysX3PROFILE_x64.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
The error is thrown by this line : PScene->getActors(PxActorTypeFlag::eRIGID_DYNAMIC, DynamicActors.GetData(), DynamicActorsNum);
This is the Call stack
PhysX3PROFILE_x64.dll!physx::Bp::SimpleAABBManager::addBounds(unsigned int index, float contactDistance, unsigned int group, void * userData, unsigned int aggregateHandle, unsigned char volumeType) Line 1662 C++
PhysX3PROFILE_x64.dll!physx::Sc::ElementSim::addToAABBMgr(float contactDistance, unsigned int group, bool isTrigger) Line 129 C++
PhysX3PROFILE_x64.dll!physx::Sc::ShapeSim::initSubsystemsDependingOnElementID() Line 105 C++
PhysX3PROFILE_x64.dll!physx::Sc::ShapeSim::ShapeSim(physx::Sc::RigidSim & owner, const physx::Sc::ShapeCore & core) Line 146 C++
PhysX3PROFILE_x64.dll!physx::Sc::Scene::addShapes(void * const * shapes, unsigned int nbShapes, unsigned __int64 ptrOffset, physx::Sc::RigidSim & rigidSim, physx::Sc::ShapeSim * & prefetchedShapeSim, physx::PxBounds3 * outBounds) Line 5101 C++
PhysX3PROFILE_x64.dll!physx::Sc::Scene::addBody(physx::PxActor * actor, physx::Sc::BatchInsertionState & s, physx::PxBounds3 * outBounds) Line 5155 C++
PhysX3PROFILE_x64.dll!physx::NpScene::addActorsInternal(physx::PxActor * const * actors, unsigned int nbActors, const physx::Sq::PruningStructure * pS) Line 583 C++
UE4Editor-Vex-7416.dll!UPhysNetComponent::ClientUpdatePositionAfterServerUpdate() Line 277 C++
If instead of the Dynamic actors I try to move the static actors I don’t get any error.
In the main scene I’ve a vehicle, so my speculation is that since the vehicle has attached the 4 wheels I have to pass to the new created scene both vehicle body and attached wheels that are not dynamic actors (or probably are not more attached each other).
Now I want try if I get this error even with a simple box in the scene.
Do you know what cause this problem, or how can I move correctly these actors between the scenes?
How can I debug to get more informations?