Download

Sockets - Weapon wont attach to Player, but player will attach to weapon?

So im a bit out of ideas, every previous article i can find relates to calling “Attach To” via blueprints to attach an actor to a socket. That no longer exists as far as i can see, so i assumed i needed to use Attach Actor To Actor.

My Starting point is giving my character all of the scripts required to pick up an object via the Physics Content example, when i right click it draws a line where i shoot(for debug) and then picks up the object. No issue with that code the objects gets its PhysicsHandle updated each tick and kind of just floats along with my character.

The issue is i would now like to take it one step further and attach said object to a socket on my skeletal mesh(the default 3rd person mesh) so that its not just floating in front of my player, so I went into Persona, created a Socket and saved it. I then created a blueprint with nothing but a Sphere static mesh in it, turned on physics and saved it.

Then ran this code

https://dl.dropboxusercontent.com/u/2798684/bpprob1.png

And when i hit the object to pick it up nothing happens. I’ve debugged it and can see that my Character is getting passed into the Parent node, the ball actor i want to pickup goes into the Target and im attaching to BallSocket socket…but nothing happens. The ball just sits there and gets pushed around like always.

What is interesting is this actually does something if i swap the actors, just not what i want. If i make my player character the target, and the ball the parent actor my player gets scaled down and attaches himself to the ball and rolls around like a moon of around the ball.

I’ve also tried attaching the ball permanently via the instructions on UE’s scripting site using Socket snapping, but the ball wont snap to the socket.

Any help would be greatly appreciated!

So it turns out part of my problem is that my Ball is a physics object, if i make it a movable non physics controlled object it picks up fine.

Any idea how you attach a physics object to an actor? When the hit detects, can i somehow change it to a static object then trigger it to attach, then turn it back into a physics object when i apply an impulse to throw it?

From what i can tell there used to be a Set Simulate Physics blueprint, but i cant find it in 4.2.1…