Replacing main Physics scene with a custom one

I’m trying to change the main PhysX scene to add a custom version of it.

I searched in the source code and I found the function CreatePhysicsScene in the class UWorld that it is called during initialization of UWorld object.

Is main FPhysScene always initialized by this function?

I need to know where is initializated the object of UWorld class. By searching through the code I found the static function CreateWorld that is used only by the editor to initialize the tools, and in the class UGameInstance I found these functions: InitializeStandalone, InitializeForPlayInEditor, InitializePIE, etc… that initialize the UWorld object but I’m not sure if these functions are called to create the UWorld object when the game will packeged (due to the names).

Where is created the UWorld object when the game start out of editor?

Please let me know how UE initialize the UWorld object, or point me to DOC that I’ve not found. Thanks you in advance!

Just going by the names you listed there, I would guess InitializeStandalone is the correct one.
However, if you open that method it tells you the world created there is only temporary, and to look for the code loading a map instead…

So maybe the world created somewhere in the middle of UEngine::LoadMap is what you want?

The initial UWorld object is created inside UGameInstance::InitializeStandalone but this is only a dummy world. The actual World is loaded from the map package and initialized inside UEngine::LoadMap. Physics scene is initialized in UWorld::InitWorld and its creation is controlled by InitializationValues parameter. So I suggest that you start digging there. :slight_smile:

Very thanks for yours responses,these information are very useful. I’m digging :slight_smile:

InitializationValues

Where can I edit InitializationValues?

I managed to override the UEngine::LoadMap, but not without errors, I also dig towards the creation of the world and so on. If you know more please tell me.