How to get changes from PhysX into UE4?

Hello everyone,

I am looking for a workflow on how to bring custom changes in the PhysiX source into our game.

We need to get some small changes in the PhysX source code done in order to solve a major bug in our project. Via Nvidia we got access to the source code of PhysX and we already have some custom C++ classes (GameModes) within our project (however, we do whatever we can with blueprints).
So far I found this Tutorial from Rama, but I could not figure out what exactly to do so far. Do we have to create a project in Visual Studio with the PhysX source code, do our changes, compile it all and then just exchange the PhysX.sln in the UE4 folder? Or is there more to it?

Background:
We are developing a multiplayer racing game. While we can get the handling of our cars done within the engine, there is one showstopper bug. When a car is stationary and another car rams it, the stationary car behaves like a stone monument. The reason for this seems to be known since 2014. But still, the issue is not resolved yet officially and, therefore, we need to do it ourselfs…

Any help (hint, link to tutorial, confirmation of my question (even a vote on the issue^^)…) would be appreciated.

Have a nice day,

Syrill

I have no idea if this helps but the car turning to stone might be the engine’s way to pause simulation for “idle” objects.

An idea about going around this is to cast rays from every vehicle and if another one is approaching to “wake the simulation up” sort of speak. You could do this by applying a force to the stationary car to wake it just before impact so the simulation has time to account for the incoming car.

Interesting idea, but the issue seems to be within PhysX. And what we have observed during our tests, the physics simulation is on. The suspension, for example, reacts depending on the impact (e.g. bomb under the car), but the wheels stay glued to the ground.

Alright, I gave it a try. See the screenshot for details, if you are interested. Sadly, it did not work.

Thus, back to the PhysX source code…

We finally managed to compile the PhysX source code!

  • First of all, you don’t need to get the PhysX source code from nvidia, it’s included in Unreal already
  • Make sure that your UE4 source folder has no spaces in the folder name (link)
  • Keep to the instructions from this tutorial and execute the batch files to generate the solution files or to build the libs
  • Finally, rebuild the engine in Visual Studio

To build the changed Physx code on a Mac change the batch files to be executed as shell scripts and change TargetPlatforms to Mac or what platform you want to build for.

RunUAT.sh BuildPhysX -TargetPlatforms=Mac -SkipBuild -SkipCreateChangelist

Remove the option -SkipBuild for the build script to actually build and not only create the Xcode project files.