x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Attach 2 Static Mesh Actors Togather Via Sockets

Racking my brain and looked and looked but does not seem possible. Take 2 simple static mesh boxes and make one socket on each box. In the blueprint use the AttachToActor and choose both boxes and the socket name for one of the boxes. Hook this up to a keyboard key.

Play and then press the key, what will happen when you run this is the socket from one box will attach to the pivot point of the second box. Is there a way to attach attach box one socket to box 2 socket.

The AttachToActor only has one socket option, it would seem like you would have another socket option for the 2nd actor.

I am making a build system and trying to snap one piece to another at run-time and though that snapping 2 sockets would be the easiest way but it does not seem like you can snap 2 sockets together.

Product Version: UE 4.19
Tags:
more ▼

asked Jul 10 '18 at 05:03 PM in Blueprint Scripting

avatar image

JohnADaniels
19 1 2 5

avatar image JohnADaniels Jul 11 '18 at 04:17 PM

Someone has to know if you can snap 2 meshes together using sockets??

avatar image Evan.Doody Jul 11 '18 at 04:48 PM

Sorry, slightly confused by the question, when you say "Play and then press the key, what will happen when you run this is the socket from one box will attach to the pivot point of the second box." do you mean that ONLY the socket, and not the entire box are snapping to Box1? You should be able to just use Attach to Actor -> Box1 as the Parent, with socket Box2 as the Target.

avatar image JohnADaniels Jul 11 '18 at 10:03 PM

The both boxes do snap together, one box snaps using it pivot point and the other snaps using its socket. I would love to know if you can snap 2 boxes together using each of their sockets. You can snap together but only using one socket from one box, there is not an option that says attach box 1 socket to box 2 socket.

avatar image Evan.Doody Jul 11 '18 at 10:24 PM

Ahhh I got it, thanks for the clarification! So "sockets" are really more like an offset translation you can put something into, like a Hand that can hold a gun, sword, apple, whatever. A solution to your problem might be to adjust the pivot point of object being placed, so the pivot is always at the bottom, and the socket is always the top, this would make things stack correctly all the time.

Another option would be to Attach the actor to a component, and then set a local offset on that component based on what is being held. This would allow something larger to stack properly, if you didnt want to be moving the pivot. You could move Box 2 to target location, offset by the location of Box 2's socket, and then attach Box 1 Actor and keep location world relative. Just some ideas, hope you figure it out!

avatar image JohnADaniels 6 days ago

Ok, thank you for the reply and for the workarounds. It would be nice if unreal added a attach socket to socket.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You simply need to get the root component of one and attach it to the root component of the other specifying the socket name. Both actors only have StaticMeshComponents, so the root component of each is the StaticMeshComponent I believe

more ▼

answered Jul 11 '18 at 04:55 PM

avatar image

KieranChandler
123 8 15 20

avatar image JohnADaniels Jul 11 '18 at 10:05 PM

Thank you for the reply KieranChandler but there is only one socket option on the AttachToActor. The other mesh it just attaches using its pivot point.

avatar image JohnADaniels Jul 11 '18 at 10:07 PM

alt text

attachtoactor.png (49.8 kB)
avatar image KieranChandler Jul 11 '18 at 10:28 PM

This is how it works, if you want the mesh to rotate around the socket instead of the root is quite simple. You can offset the second mesh by the relative location of the socket after attaching.

avatar image JohnADaniels 6 days ago

Ok, thank you for the reply and for the workarounds. It would be nice if unreal added a attach socket to socket.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question