Code For you, Using UWorld* To Get PhysX Scene
I’ve added to my PhysX Wiki showing you some code and additional #includes to use to get access to the PhysX Scene in a way where you can do low level multi-threaded PhysX coding!
Rama’s Wiki on PhysX Coding in UE4
**PhysX + UE4 Code For You!**
Here's the code that you can use to get started in multi-thread friendly way, please see my higher post for more places to look for PhysX code in the UE4 code base.
//For the ptou conversions
//For Scene Locking using Epic's awesome helper macros like SCOPED_SCENE_READ_LOCK
void SomeClass::SomeFunction(UWorld* World)
//if crash here world was not valid, needs to be investigated, did it come from a UObject?
FPhysScene* PhysScene = World->GetPhysicsScene();
// Scene Lock for Multi-Threading
PxScene* SyncScene = PhysScene->GetPhysXScene(PST_Sync);
//now you can use the PhysX scene in multi-threaded fashion within this function context!
Note on UWorld*
Any Actor can easily just call GetWorld() to get you the UWorld* ptr
UWorld* World = YourActor->GetWorld();
UObjects can do the same but its not quite as reliable depending on the UObject
Have fun doing low level multi-threaded PhysX coding using the awesome Epic helper functions of PhysXSupport.h!