Create Sockets on Static Mesh via Array of Transforms - Blueprint Only -

I had many (30), scene components (Arrows) on an actor to mark location and rotation for projectile spawn points on weapons, and I would use these transforms to spawn projectiles.

I would like to try using sockets instead, but when placing sockets, I cannot create an arrow for alignment purposes. so would like to place them using arrow scene components, then make a Utility Widget that will copy the arrow (scene component) transforms to the static mesh as Sockets?

I see a “Add Socket”


But dont see how to use it
Searching online gets me results for attaching to a socket, but did not see anything with Add Socket?

If I cannot create a socket and save to static mesh, could I manually add 30 Named Sockets, then have the utility widget set the transforms?

I’ve not heard of this before with static meshes. Of course I have used sockets with skeletal meshes, where a socket can be attached per bone and dragged around like your “arrow” aka previous scenecomponent solution. That you can add it to a static mesh is new to me.

Because you mention it’s going to work with weapons, aren’t you actually looking for some kind of pawn with a skeletal mesh, instead of the static mesh? Even if it’s not going to be animated, you could import the mesh as a single bone skeletal mesh and add sockets to that root bone.

As I see it, if you convert those scene components to socket positions (3D vectors), you are performing a destructive operation if you’d then remove the scene components in favor of the socket positions. Because, if you ever want to make a change to the model, you’d have to recreate and reposition those scene components again to get things in the right place.

I am making a 2.5D Side-sroll pace shooter, and setting up for players to be able to customize the ship. If I create a weapon, I can place sockets on the locations and rotations of the barrels etc., where it’s projectiles spawn.

I then have Selectable Fire Modes for each weapon, with custom blueprint code defined for each weapon. The code can get the sockets, and I can name the sockets in a manner I can parse the name to get the socket number, so that projectiles fire in a specific order. This way, I can do complex fire modes.
Low Power Single Shot - Cycles through each barrel socket in order (Have to maintain weight symmetry :wink:
High Power Single Shot - Cycles through each barrel socket in order (Less Frequent Shooting)
Low Power Multi-Shot - Fires all Barrel Sockets simultaneously
High Power Multi-Shot - Fire all at High power (Less frequent shooting)

Each weapon can have custom code to handle multiple counts of fire modes each.

So, when I do complex missile systems, I can have missiles with various behaviors like homing etc., but also single fire single target, multi-fire single target - multi fire multi target etc. Or even choose missile type by having each set of barrels/Sockets associated with a missile type.

Example, I have 3 wings with weapons mounted om each side of the wing (same weapon mounted on each side) and each wing has 2 weapon sockets, which are defined by the wing static mesh (I can have modular wing designs as game story progresses), and each weapon will have the barrel sockets.

When the pawn is constructed, i can i read a load-out save file to construct the pawn using data assets and save game files, and then get the sockets dynamically from the static mesh. I would think this would be good for modding as well no?

No need for skeletal (lower performance), easy modular design and helps build a framework I can reuse


The Black holes are missile tubes, and there are 30 total on the ship (5 on each side of 3 wings)
For the weapon Meshes, each weapon is designed for a specific slot on the wings and ship, so only certain weapons can be picked for certain types of slots, this setting can be parsed from socket name

I discovered I could import sockets with the static mesh by exporting an empty with the mesh that has to be named “SOCKET_X” where X is what you custom name. This is the prefix for import.


You can also, then in editor, assign a tag to the sockets

so you can use the tag to get sockets via blueprint

This way also, I will have sockets on the fuselage as well for wing placements and minor weapon sockets. It will always have 3 wings, but the wing design can change and even have different sockets and# of sockets for weapons. The fuselage can be swapped, and have different wing configurations and count. This one here has only 3.

It works amazing well to have the sockets on the actual static mesh, and not have to have a scene component on an actor.

This way, I can create random enemies by making modular design ships, and they wont have to be actors, they can just be spawned static meshes and moved as a group by an enemy manger subsystem

I would still like to be able to dynamically create and set sockets on static meshes via Utility Scrpts

Hi, I haven’t seen anything from BP that can do this, even from a Utility Script - a search through google didn’t find anything just now either.

You can do it from c++ though, like:

    UStaticMeshSocket* sock = NewObject< UStaticMeshSocket >( mesh );
	sock->SocketName = "MySocket";
	sock->RelativeLocation = FVector( x, y, z );
	
	mesh->AddSocket( sock );

I’ve done something like that in a plugin for copy/pasting sockets and it seems to work well (except doesn’t update the sockets list in the details panel).

Adding a subsystem to my rdMeshTools plugin to expose the socket functions is on my ToDo list.

hmmm, would be nice to have native since already in C++, it would be an easy thing for Epic to add no?

This way, I can stay updated regularly and not be dependent on waiting for others to update a plugin for somethig that could be easily added?

1 Like

Yeah, the routine to add the socket should be easy to add to the engine - perhaps make a post on “Feedback and Requests”?