Crafting system with sockets?

Hi there,

I want to make a crafting system, that players can add for example planks on certain sockets, is that possible?

Bye,
Bart

The short answer: yes.

The long answer: there are a lot of ways you can achieve this. For example:

  • Make each plank/object it’s own Actor and then just attach it to another Actors RootComponent
  • You can do the thing above but attach it to a SceneComponent’s MeshSocket of that Actor
  • Prebuild an Actor and make every Object a SceneComponent and attach those
  • You can make an Actor with GhostPlanks(transparent indicators where planks can be attahed) for example, and then just replace those with actual planks (using either Actors or SceneComponents, like described above)
  • You could also attach them physically using PhysicsConstraints.

That being said, I don’t know what game you are trying to make, but the answer is almost certainly - yes.

Hi there,

Thanks for your answer!
Im making a building game so i want that can create their own objects :D,
If i use this, is it possible for the player to use the sockets from plank 1 and from plank2?

Bye,
Bart

Yes, sockets are part of the mesh, you can use any socket of any mesh whenever you like.

How can i get the sockets from the mesh that i want to use for the crafting, first i was thinking of an arraylist in the object, with the socket names in it, is there a better way to do it? (i want to create that the players can use multible resources at once)

Both UStaticMesh and USkinnedMesh have this function to querey what sockets a mesh has.

In BP you can just call this helper function