Change Static Mesh Collision Preset to Complex as Simple

Hi.
The goal is to set Static Mesh Collision Preset as “Complex as Simple”



UStaticMesh* StaticMeshAsset;

StaticMeshAsset->BodySetup->CollisionTraceFlag = ECollisionTraceFlag::CTF_UseComplexAsSimple;
StaticMeshAsset->BroadcastNavCollisionChange();


It changes Collision Preset value. But not a Collision.
What am I missing?

1 Like

You can’t change it on the asset - you would have to change the flag on the static mesh component instance that is in the world, however many of them there are that use that mesh. Assets can’t be modified at runtime.

Thanks for the reply, TheJamsh.

I was looking, how to modify assets in the editor, not at runtime. Sorry, didn’t write that in the first post.

However, for me it worked, when I added



StaticMeshAsset->Build();


It worked, but I don’t know if I can use it.

2 Likes

you could use the project settings, Default Shape Complexity

In UE5 you need:

StaticMeshAsset->GetBodySetup()->CollisionTraceFlag = ECollisionTraceFlag::CTF_UseComplexAsSimple;
...
2 Likes