Spline mesh collision missing from packaged build.
I have been working on a procedurally generated infinite runner style game with a series of spline mesh tubes as the level. If the tunnel spline and spline mesh are generated at runtime the collision data will be missing, but only in the packaged build. It works fine with per poly collision in the editor. I have tested other collision types and primitives but I still get the same problem.
When generating the tunnel in the construction script the collision is fine in the packaged build but then we can't exactly have a different tunnel each time the game runs; like I intended.
Is there a way to cook physics at runtime; or is this a bug?
(using v. 4.6 and packaging for Windows 64bit)
I have been getting some PM requests to help with/clarify this solution, but really don't have a lot of free time right now. Posts to forums tend to help multiple people in the future as well.
NOTE: This is just a quick, messy hack. I couldn't see an easy/clean way to patch the engine (don't know the code/possible side effects well enough).
You could just force collisions to be enabled directly in USplineMeshComponent::PreSave() if you really wanted to. This means running a (re)building source and running custom version of the engine (applying the hack/fix everytime you update). You could also make a local game code wrapper for USplineMeshComponent and override PreSave() in that class.
In my case, I have a container class that holds a bunch of instanced spline meshes.
When the editor is running this code, the next time the level is saved out the spline meshes will have collision data.
Extra credit: Now if you happen to be using something similar to the container class solution above and happen to be dragging (road) spline meshes around to position them you have a problem. Everytime a spline mesh is saved during an editor session, the collisions are turned back on and dragging splines around becomes super slow.
With the exception of UObject::PostSaveRoot(bool bCleanupIsRequired) which is for asset packages, there don't seem to be any build in methods that are automatically called after an object saves.
answered Jul 01 '15 at 12:47 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here