SplineMeshComponent collision not working at runtime?

I installed UE4 two days ago and have been messing around with trying to procedurally create a track to traverse in a vehicle (building off the basic vehicle template).
I’ve created a basic blueprint for a spline component which adds an appropriate number of SplineMeshComponents based on the amount of points on the spline. Using the event graph, I’ve then added functionality to extend the spline in the Y direction every time a key is pressed (F). Collision works fine for the initial points created in the editor, but collision does not seem to be enabled/working for anything created at runtime and I’m unsure of why. Here is an example using simulation mode and the “Player Collision” view.

The location of the car is where the spline ends after having been created in editor mode. Collision seems to be working for the length of the blue arrow. The points after the vehicle (the length of the red arrow) do not seem to be working and the vehicle simply falls to the floor past it’s current point.

Here is the blueprint’s current construction script.


Here is the blueprints event graph.


I’ve selected “Collision Preset: Block All” for the function “Add SplineMeshComponent” in both cases. Does anybody have an idea as to what I’m missing in order for this to work?

Hi Callan,

For testing purposes, what version of the editor are you currently using?

Hi TJ,
I’m currently using version 4.7 of the editor.

Thank you for the report. I was able to reproduce this and I have entered it as JIRA UE-8565 in our tracking software. Our developers will be looking into the issue and we will post an update here as soon as we can.

Unfortunately I don’t have a workaround for the issue at the moment, but I did notice what was happening. The collision is being spawned in for the mesh but it’s being spawned in at the 0,0,0 location relative to the blueprint. You probably didn’t notice this unless you you experiment with different sized meshes.

Cheers,

TJ

Hello TJ,

After further testing I have found that the issue here was with my blueprint. The collision was spawned in at 0,0,0 because I was executing “Set Start and End” after executing “Set Static Mesh”. I’m going to assume that “Set Start and End” when called on a SplineMeshComponent ,that has an attached StaticMeshComponent, only updates its rendering position and not the collision position, leading to the issue I was experiencing (i.e. visibility collisions were correct, but player collisions were not).

Regardless, thank you for the quick reply and your help on the matter; I now have an extendable and collisionable spline!

So my next question is: Does the collision still work in the packaged version of your game? Mine works fine in the editor but all collision disappears when I package it up (for Windows).

I have the same problem. Works fine in the editor but if I choose to run it as “Stand alone game” my pawn goes straight through the ramp. Anyone else seen this? Actually, if I check the collision view in the editor there doesn’t seem to be one for the spline although if I run it in the editor it actually collides.

Hi formatt,

Thank you for adding to the report. I updated the JIRA to show that additional users are experiencing this issue. Our developers are still investigating it and we will post back here with updates.

Cheers,

TJ

1 Like

I can’t get collisions working, even when using no set static mesh or doing it after the Set Start and End. It is only colliding at 0.0.0. Any update on the bug?

Hi Davision,

This is still an active JIRA in our system. It is however lower priority than crash bugs and showstoppers but it is still in the queue to be investigated as soon as possible.

Has this been solved? My entire project for the game jam this month won’t work if this can’t be resolved…

Hi TheAwesomeTh3ory,

This has not been resolved but the developers are actively investigating the issue. However, if a fix does go into place, it will likely be after Game Jam is over. Since there is not official workaround, I suggest altering your implementation to get past the issue.

Hi,

just chiming in to say that if this was fixed soon for packaged games, I would be so happy.

My game’s whole concept relies on spawning roads at runtime so I assume my options are to spawn a load of collision volumes to match the mesh or go into the source code and attempt to fix this myself.

Okay, phew, I’ve drilled down into the source and fixed this to my satisfaction. I’ll submit a pull request to Epic and maybe save someone some time.

In the meantime, if you need this functionality, the solution is:

-Follow the instructions for downloading UE4 from github. This takes a long long while.

-Once Visual Studio opens make the changes in attached image

-Continue building the engine and the editor

-I guess from here you create a new project and once you’re satisfied that a packaged game can recalculate collision at runtime, migrate your old assets.

Happy programming!

1 Like

Just FYI, the feature request UE-8565 to Support runtime generation of spline mesh collision on platforms that have runtime physx cooking enabled has been implemented in Perforce CL-2937854 by accepting pull request 2064. This change should make it to GitHub the next time the perforce stream it was added in is merged to main, and we plan to include that change in the 4.12 release.

Thanks!

1 Like