Question about Dynamic Collision Recreation

Dear Friends at Epic,

I know SplineMeshes are not ready yet, but when they are, I am very excited about using them in my in-game editor

But for me to be able to manipulate the spline during game time, I would also need to be able to re-create collision on the fly.

I see the function is there already, but it is limited to use with the editor


RecreateCollision

I noticed that RecreateColllision() only worked WITH_EDITOR

is there a reason we cant call this from c++ during game time in a shipping build?

#if WITH_EDITOR
    // Builds collision for the spline mesh (if collision is enabled)
    void RecreateCollision();
#endif

#I Entreat You To Please Make This Runnable During Game Time

Because then I can fully implement dynamically changeable Spline Meshes in my in-game editor!

:slight_smile:

(Again my in-game editor is in no way meant to mirror the Rocket Editor, it is an in-game editor because every feature is game-specific and using my own in-game interface).

Thanks Epic Devs!

Rama

Hello Rama,

We’re working toward responding to your question as soon as possible. Thanks for your patience.

Sean

I’m going to check if it actually depends on anything editor-wise, and if not I’ll remove the #if WITH_EDITOR for you, with a warning that it will probably be slow. In the editor, we had to implement code that defers the recreation of the collision while you are altering a spline, because it was too slow to do realtime while you were dragging points around.

woohoo! thanks so much Gareth!

I am very happy to be the recipient of your first answer :slight_smile:

Rama

Unfortunately RecreateCollision calls various functions on UBodySetup that on cooked platforms (i.e. non-editor) only support loading cooked physx collision data, not creating it on the fly. Sorry, but making USplineMeshComponent::RecreateCollision() able to be called during game would require this restriction to be lifted, and I don’t think that’s something Epic will want to do.

aww well,

I will still be able to create some awesome prefab meshes using splines for ramps and race tracks etc

It’s nice to know for sure though, so thanks Gareth!

Rama

I suppose that is because it’s expensive since we have to create collision in game when spline has changed. I’m adding Jack for more detail of plan.

It would be really great if I could run that function during game time for use with my in-game editor, once splinesmeshes officially are released!

:slight_smile:

Rama

Is this ever going to happen? I built a game that procedurally generates a spline mesh tunnel at run time and got burned because its not possible. Now I’m currently Greenlit on Steam and don’t know what to do other than making prebuilt levels.

Just ran into the same problem. Wanted to use splines to make the wall system of a RTS game but yeah, the collisions aren’t re-created when spawning splines outside of the editor… :<

Just ran into the same problem. Wanted to use splines to make the wall system of a RTS game but yeah, the collisions aren’t re-created when spawning splines outside of the editor… :<

Just saw the 4.12 Changelog… “Collision can now be generated for Spline meshes created at runtime.” !!!

YES!

did you ever figure a solution to this?

really? i got no such feature in 4.20…?!