How do I attach an Actor Blueprint to a socket in a Character Blueprint?
I got a headless player character (blueprint) that I need to attach a head (blueprint) to when it spawns in the level, but I just can`t figure out how to make it work. As far as I know, this should be an easy task to do using the Construction Script of the player character, but at the moment I am not sure how I can fetch the head blueprint in my player construction script and attach it when it spawns.
I tried a couple of solutions that I thought would work, but with no luck.
Could anyone point me in the right direction please? :)
asked May 21 '14 at 11:42 AM in Blueprint Scripting
Have you tried the following from the Event Graph:
Give it a dummy transform and snap to target on the Attach node (this is assuming your character has a socket in the SkeletalMesh that you can assign the BP Actor to).
As an example here's my head:
Might be another way to do it, but this is what first popped into my head. :)
answered May 21 '14 at 02:37 PM
Wes Bunn ♦♦ STAFF
[Better Solution in the next answer below]
I solved this. In our game we can pick up Actors (e.g. a Katana) that are a static mesh and have physics.
The following blueprints do it as a macro.
Upper level call:
Lower Level Left:
Lower Level Right:
And the result. The swords on the ground are Actors with physics. The one in hand is just a mesh derrived from the picked up Actor. After pickup the Actor is destroyed from the world. Dropping the sword is the reverse. Or mayby I'll keep the sword actor around but turned off.
Ok, we discovered it is very valualbe to have the actual picked up Actor in hand so its scripts can do things. E.g. track sweep attack points in a sword. So we revisited this code and figured out a better way to do it. This als allows for multiple meshes in the actor, and is simpler.
Here it is.
answered Apr 04 '15 at 09:10 PM
SND R Keene
Follow this question
Once you sign in you will be able to subscribe for any updates here