Houdini Engine for Unreal
 All Files Pages
Mesh Sockets

Mesh sockets are extremely useful if you want to attach something to your meshes in Unreal without having to parent and set the transform of the objects manually. Houdini Engine for Unreal supports the creation of mesh sockets either by using Point Groups or with Detail Attributes.

By default, found sockets are attached to meshes generated by the same part. If no valid meshes for that part are found, then the sockets will be attached to meshes created from the same geo as the sockets.

Set up

Using Point Groups

In order to do create mesh sockets, you just need to assign points to a point group starting with the mesh_socket prefix. The position (P) rotation (rot) and scale (scale) attributes of these points will be used to define the socket's transform. If the rotation attribute is not found, the socket's rotation can be deduced from the normal (N) attribute of the point if it's present. Please note that the rot attribute should be set as a quaternion (float 4) and not an euler angle.

You can define a socket's name by adding a string attribute to the points named mesh_socket_name, and a socket's Tag by using an attribute named mesh_socket_tag

Unreal_SocketsSpreadsheet.png

Spreadsheet view of 3 sockets name Top, Bottom and SIDE in a "socket_cube" group

The generated sockets can be displayed and edited in the static mesh editor, and you can attach actors to them like you normally would, either by drag and dropping an Actor on the asset in the world outliner or by using “Attach to” in the context menu.

Unreal_Sockets.png

View of the above sockets in Unreal's Static Mesh Editor

Using Detail Attributes

Alternatively, you can also create mesh sockets by using the following Detail Attributes:

mesh_socketX_pos (float 3) Vector3 representing the socket's location.
mesh_socketX_rot (float 4) Quaternion used for the socket's location.
mesh_socketX_scale (float 3) Vector3 representing the socket's Scale.
mesh_socketX_name (String) for the socket's name.
mesh_socketX_tag (String) for the socket's Tag.

X being the 0 based index of the socket.

Here's an example VEX snippet that can be used in a attribute wrangle to create two sockets via detail attributes:

v@mesh_socket0_pos = {0.5, 0.5, 0.5};
v@mesh_socket0_scale = {2, 2, 2};
s@mesh_socket0_name = "plip";
s@mesh_socket0_tag = "test";
s@mesh_socket0_actor = "Cube";

v@mesh_socket1_pos = {0, 0.5, 0};
v@mesh_socket1_scale = {0.5, 0.5, 0.5};
s@mesh_socket1_name = "plop";

When possible, using Detail Attributes is recommended over Point Groups, especially when using Packed Primitives.

Pre-assignement

You can pre-assign Actors to the sockets generated on Static Mesh Components by the plug-in.

This can be done by adding a string attribute named mesh_socket_actor containing the name of the actor that you want to assign to the socket. Multiple actors can be pre-assigned to a socket. This can be acheived simply by separating their names with , or ; (commas or semicolons).

The corresponding actors will automatically be attached to the sockets in Unreal upon cook.

Note
Please note that currently, the socket assignement logic expects the name of an Actor in the world, not a reference to an asset in the content browser. If multiple actors in the world match the mesh_socket_actor attribute, they will all be assigned to that socket. Also, if multiple sockets point to the same actor for pre assignement, only the last socket processed by the plugin will have the actor assigned.