Need help with detecting a intersecting overlap

Hi guys,

I’m trying for weeks now to find a possible solution to my problem, but now I’m just in despair…

It’s about a runtime building system, static meshes are NOT allowed to stand alone, so they must be connected to another mesh, and are also not allowed to intersect (just a little bit to define that visible connection).

In the Image you see, the meshes should only be placeable if they intersect a little bit with each other.
But As far as I know it is not possible inside unreal to determine how much of an mesh is overlapping with another one (intersection size) so I’ve tried some workarounds…

  • The simplest thing I tried was: when moving the static mesh, it checks for overlapping meshes and not allow placement if it overlaps, but then the meshes could stand unconnected in the room.

  • I’ve also tried to use sockets in the meshes as snapping points, so when the meshes are moved they snap to specific locations when they are near enough. But this limits positioning a lot, what I really don’t want to, AND when I rotate the mesh after positioning it could possibly intersect or stick completely inside that other mesh.

  • The next thing was, I duplicate the current static mesh on selection, scale it a little bit and when moving the original mesh checks if it IS overlapping and the duplicated mesh IS NOT overlapping to allow placement. But obviously meshes scale from their pivot, and thus it won’t work as expected. It needs to move every vertex along their normals so it would work as expected and maintain the shape.

While that’s easy with materials, I have no Idea how to manipulate the static mesh vertices with code.

  • Then I thought maybe It would be easier to bring procedural mesh component into the game, but I also don’t know how to scale the vertices along their normals after coping the mesh sections from the original static mesh to the procedural mesh…

Oh, it must also work with mobile.

How would you solve that problem or have you any other suggestions?

thanks. :slight_smile: