Download

Attach to actor help!

So I want my currency mesh to appear above the characters head when I collect it. I have this working by simply spawning the money and then setting its location to above my characters head but updating this on tick seems to cause stuttering so I thought attaching it to a bone in the characters skeleton would be better except I can’t seem to get it to work. I’ve been messing about with the attach to actor node and just referencing my money indicator and third person character and setting it to the bone I created but it doesn’t work. I’ve tried this in every way I can imagine and it just doesn’t work, what am I missing? how do I get this to work. I saw a tutorial on this and the guy was dragging the mesh on to the bone in the skeleton but ue4 doesn’t let me do this does it need to be attached to the skeleton for this to work?

Any help would be greatly appreciated.

&stc=1

Im not sure if youre supposed to use get player character. Try using self node instead and if that dont work use the mesh node of your character.

I’ve seen people using this mesh node I don’t seem to have one? for some reason the only one that shows up is for a vehicle I also tried just casting to third person character.

Can you screenshot whats in the left of the blueprint where it shows a list of your scene and what childrens you have in the scene.
Thinking about this I see its done in the money blueprint. I usually do mine in the blueprint that is going to be attached to. So all in all since this isnt in the character blueprint you need to access your character bp to get the mesh of your character. The socket name you used is money indicator. Where is this socket located?? And it has to be correct spelling so does the socket also contain a space between money and indicator?

The money blueprint is just an empty actor with a mesh and capsule component for collision it had two variables on is money value sets how much the money is worth and the other is money type which sets what to call the money. As far as the joint goes I just added a socket to the head socket. The static mesh that I want to add which is called money indicator is just an empty actor with a static mesh in it I figured it would be good to have a separate actor to attach to the socket instead of grabbing the mesh from my money blueprint class which handles the collision etc then the actual numerical logic for adding money to the variables which I have stored in my game instance is done in my third person character so really theres not a lot going on in the money blueprint class except detecting collision and destroying the actor. And there is literally no script in money indicator I hope this makes sense.

To summarise I have four blueprints that are involved with the money.

1st MoneyBlueprint which is actor that stores money mesh and handles the destroy actor when collided with

2nd Money instance which has a dummy mesh of the moneyBlueprint and is the one I want to attach to my third person char

3rd MygameInstance which stored the values for the moneyBlueprint

4th Thirdperson blueprint which handles the math for adding the money value to the Gameinstance’s variables

The sockets name is now Money can’t remember what it was before but it’s in the picture from my last post.

Ok so where you have get player ciharacter spot. You need to have a variable that is your character reference then you use that variable and pull out of it your mesh variable and connect that where you originally have get player character because that is where the socket is stored. If this doesnt make sense I will see if I can post some screens when I get home

Thanks yeah some screenshots would be nice I kinda half follow you but what variables are you talking about?

So I Made an actor BP and called it money. I put a collision box and Static mesh of a cube in there and made the static mesh have no collision.

1bfa8ada5aeaa4a03be34d0ff6108466c87cee2d.jpeg

The variable ThirdPersonCharacter is a variable I created and for the type I just did ThirdPersonCharacter.

a53202ff4e53c187791140aabf0d11396be71d77.jpeg

The only code I did here was On ComponentOverlapBegin it gets the actor that entered the collision box, casts to the thirdpersoncharacter bp and if thats true it attaches the static mesh of the money bp to the actor.

808d784dfd5df9ac671e18a97467d3732c94d3be.jpeg
0f6534a4f9cb97e04f82ef811096dceb5dc6b9b3.jpeg

Make sure on “attach actor to componenet” not attach actor to actor, make sure you select snap to target on all location rotation and scale/

Hope this helps

also to get attach actor to component theres different ones… best way to do it, grab the self node like I did and pull off that string to attach actor to component so the node will say"AttachToComponent" and right under it it will say Target is actor. like in the screen shot.
otherwise its the wrong one.

Sorry its the node attachtocomponent

Wow thank you this is very helpful I really appreciate the help I’ll give that a test once I get back from work. Just a quick question how did you get the get mesh when I tried that the only one that showed up was for the vehicle class?

In the blueprint for thirdpersoncharacter there is a skeletal mrsh of the ue4 guy called “mesh”, honestly it can be called what ever you want but its referring to the skeletal mesh that has the money socket. When you attach it to an actor and say attach to socket money, it has no idea what is socket money. So you have to reference the skeletal mesh called “mesh” because thats where the socket money is held. So if you make a variable, call it whatever but the type of the variable, I used thirdperson character reference. So immediately it grabs the thirdpersoncharacter blueprint and out of that I pull a string, type “get mesh” because inside that blueprint it has a “mesh” thats a skeletal mesh of the ue4 gray dude. Now that im thinking about it. Im using the third person template. When you started your project, did you use a template or standard blank code?? Plus here might help, send a screenshot of your player character that you control. But the viewport one like I did in my first picture. But instead of the money bp take it of the player you control. You may not have a mesh name in there and that maybe why you cant get it. But if you take a screen of your playable character I can tell you which one to grab instead of mesh because you may have a different name

Thanks for all your help really appreciate it I’m using the third person template ATM but I found out why I couldn’t find the mesh I was typing it in lower case but it has a capitol M my silly mistake still think it should have found it for me I hate things like that. I’m just giving your example a try now I’ll let you know if it works for me.

Well it kinda works it attaches the static mesh on the joint but it attaches it on its side and once it attaches it locks the position of the character. I recreated what you did to see if it was a problem with the way I was doing it but it still locks my characters position. I did create a variable with the character reference like you did and set it and then called it the same way you did but I took it out because you can just get the as third person character notch and attach it to the mesh and I’m pretty sure that does the same thing. I feel like I’ve said attach a lot in this comment.

&stc=1

Did you set the mesh that attaches to the player to no collision and make sure thetes no other collision in the bp causing it to lockup as well?

I was sure I replied to this earlier !? yeah collision is turned off.

Sorry my bad collision was on it’s working now thanks for all your help.

Hmmm at this point thats stumping me. But its hard to tell since I dont have the project.
When I change my static mesh of my cube to block all it locks my character like you explain but if I change it to no collision its fine even if it overlaps the mode. So looking at what you are spawning, in your money indicator blueprint does anything in there have collision turned on??

Sorry i made a mistake and clicked the wrong checkbox collision was on but I turned it off and now it works perfect thanks for all the help.

Glad its working!