Collision to mesh validation

I have several objects with complex mesh and collisions.

Both with mesh-collisions
And added collision boxes through components

Can I somehow validate them?

Something like this:

(idiotic solution)

Get static mesh “bounds” and if it’s >= collision “bounds” → print string: “{object_name} has mesh that is bigger than object’s collision”
(unfortunately this will work only from inside of an object blueprint and print the string upon starting playmode)

Would be cooler to have this inside a “validator” of some sort, that can get an array of objects and check them by the code

But this way I’d have to get an array of objects of the same type somehow.

Sorry for asking stupid questions tho.

The simplest solution I can think of is to make a validator actor and place it in the level. If you mark a custom event as “Call in Editor” it will appear as a button in the details view. Then you can get all the actors already present in in the level and check their bounds.

There are several things to note here:

  1. You should probably use some specific class on GetAllActorsOfClass which you are certain that has both mesh and a collision because now it marks all static meshes as they don’t have separate collider;
  2. Moreover this code is only looking for BoxCollision and StaticMesh. If you have different colliders or meshes you should revise the code.
  3. This comparison is not good. You should probably check X, Y and Z independently and log if any of the dimensions fail.
  4. If your game is not running you will be able to see the message only in the Output Log;
  5. This only works for objects already in the level. Not for their classes in the Content Drawer;

There is a better way to do it though…
Use: Editor Utility Widgets in Unreal Engine | Unreal Engine 5.3 Documentation | Epic Developer Community

They are a bit more involved but can access classes in in the Design Drawer. (without having to place an object in the level)

1 Like

Thank you so much!