Procedural mesh and runtime collision update

Hi! i’ve implemented my own C++ classes for procedural landscapes. Obviously it needs collision to interact with player’s actor. I used some functions and lines of code which i found in Engine’s sources and implement runtime collision update.
It works fine in editor, it works fine in standalone in editor, but in packaged build it crashes with something like this:


PhysX3CommonPROFILE_x64.dll
PhysX3CommonPROFILE_x64.dll
PhysX3CommonPROFILE_x64.dll
UE4Editor-Engine.dll!UBodySetup::ClearPhysicsMeshes() \engine\source\runtime\engine\private\physicsengine\bodysetup.cpp:220]
UE4Editor-Engine.dll!UBodySetup::InvalidatePhysicsData() \engine\source\runtime\engine\private\physicsengine\bodysetup.cpp:710]

also i got these lines in log file (only in package build):


LogPhysics:Error: Attempt to build physics data for ProceduralMesh.BodySetup when we are unable to. This platform requires cooked packages.

I had same issues with “play in editor” before, but now i can’t reproduce it. Problem disappeared when i remove “InvalidatePhysicsData” from my code, but collision disappear too.
Need some help with explanation of runtime collision cooking or something like that, because i saw it is available in engine, but i can’t find example projects or any *.cpp where it is implemented.
Engine version is 4.9.2 from GitHub.
I can make vids or explain how my code works if needed.

// для русских :slight_smile:
Проблема с коллизией в распространяемых билдах проекта, крашится при первом обращении к InvalidatePhysicsData. Не знаю что делать уже, перерыл исходников на пару книжек и ничего путного. Весь “полезный” код зашит в WITH_EDITOR

Have progress with issue. Pure recreation of BodySetup is good choice, but it freezes the game (in my case for 50-110ms) every update. I found hotspot in CreatePhysicsMeshes() function call within in-engine implementation of physics cooking. Seems to be reimplemented on my own to make it working async without engine source edit.
By the way, async collision update works correctly and looks great in-game :slight_smile:

1 Like