[solved] How to add sockets in Blender?

Having a hard time finding something that should be simple. What exact objects do you place in Blender that convert to sockets in UE4 meshes?

Sockets are a UE4 editor thing. You don’t make them in Blender only in the engine.

Static meshes don’t use the same types of sockets. You have to create them in engine for it through the socket manager.

Otherwise, the empty on armatures works. But it may be preferable to just use a bone instead.
if the purpose is animating.

Figured it out:

  • add Empty >> [something] to your mesh (I used single arrows so you can see socket orientation)
  • added empty object has to be named beginning with “Socket_”
  • you can add and export them as static or skeletal mesh
  • sockets do not have to be parented to mesh in Blender

Below is a single socket at the center of a mesh with export settings. It seems preferable to have your sockets in the Blender source? If you ever have to update the mesh you would lose your sockets added in Unreal editor. (or is there some way around that?)

4 Likes

It is my belief that re-importing a mesh doesn’t kill any of the additional data you’ve added to the mesh. I could be wrong, though? Some data might go away? It’s been a while. Best way to find out is to simply try on a sample asset :slight_smile:

I just tried it. Reimporting a mesh:

  • preserves the sockets added in Editor (though changes order) :smiley:
  • deletes preview meshes :frowning:
  • deletes custom collision and generates new collision :frowning:

Good to know!

It only deletes custom collisions if your import settings are set to generate collision.

2 Likes

be aware about scale and axis orientation
here in unreal engine you got wrong scale and axis orientation

here some addon I make for that solve the issue

^ Good point. Yes, you have to set up Blender Scene Unit Scale system before modeling for Unreal. After that you will want to adjust your grid. Easiest thing to do is setup an empty Blender file with the correct settings and use it for a template.

I figured it was worth writing down my current workflow for sockets in Blender, as it was a bit of work to assemble all the pieces.

Like @Shmoopy1701 explains above, I use an Empty starting with the name SOCKET_, and position it as needed. Worth noting that if you’re trying to take the transform information from another object in Blender: some forms of parenting in Blender apply a hidden “Parent Inverse”, resulting in the empty staying where it was, rather than taking the location of its parent. You may have to “Clear Parent Inverse” to get the empty to match the location of the parent, like you might expecting coming from Unreal or any other 3D package in the world.

It is also important to remember to select both Mesh and Empty when exporting your mesh.

I use the copy transforms constraint in Blender to get similar socket behavior in Blender as in Unreal. Turning off the constraint gives a mesh that will attach to a socket in Unreal in the expected way. But while all the meshes import into Unreal with correct transforms, the sockets are 100 times too large, as described above.

  • It can be compensated for in Unreal, but that has to be re-done on every import.
  • You could use an addon, but that’s a whole bunch of extra code.
  • You can use the Blender driver system to alternate between display and export mode.

image


You can open the context menu on the Enable/Disable constraint icon to create a driver.
I chose to use a custom property on the world object, though you can also add a custom property on an empty in the scene. If you do use the world, you will have to change the ID Type for the prop used in the driver editor.
3 Other drivers can then be used to set the scale of the X, Y and Z scale of the Socket Empty (once again using the context menu on each of them in turn), using a ternary python operation:

0.01 if var > 0 else 1.0

If you need to do this it may be useful to know that you can either copy/paste drivers from one object to another, or link their animation data.

If you have all the attachments in their own collections, you can batch export everything at the same time.


Note that the file name is empty, in the folder icon is deselected, so that each collection will export under its own name, but all in the same folder.

1 Like

but how do you attach the empty to the bone ? blender cannot do that afaik