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?
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).
I did something similar, but it didnt work when I used a blueprint with a skeletal mesh. It just fell through the player and went on living its own little “physical” life. I also tried doing it using the constuction script, but that didn`t work at all, which is a little bit weird. Oh well…
It seems to work like a charm when I use a regular static mesh though, so hopefully this gameplay idea will work out in the end.
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.