I’m trying to use sockets to attach weapons to my 2d sprites and I’m a bit lost on how to setup the BP. I setup my BP for player character as a Paper2d BP. I’ve made walk and idle animations using flipbooks. I’ve added the sockets to the individual sprites that are in the flipbooks assigned to my character. Walk and Idle animations are working perfectly. I figured the next step would be to add the weapon as a component inside of the BP and attach it to the socket I created in the sprite, but I haven’t been able to find any commands that would allow this to happen. If anyone has any advice or tips they could throw at me, it would be greatly appreciated. Thank you!
Unfortunately, right now sockets are only supported on individual sprite components and don’t work on flipbooks. This is something we’ll be adding in a future release, but I can think of a couple of ways to fake it right now (though nothing that feels great).
One approach is to create another scene component in the actor that contains the flipbook, which will serve as the fake socket. Each tick, you would read the current frame from the flipbook, and from that, query the socket location and reposition your scene component node to match.
Call GetSpriteAtTime() on GetFlipbook() using GetPlaybackPosition(), then call FindSocket and use the LocalTransform from that. It’s kind of roundabout but should get the job done.
Thanks for the quick response. Glad to know I wasn’t overlooking it, was feeling pretty lost and I see why now. I’ll give the roundabout method ago.
ah rats, I was curious about that little socket button too. Question for you Michael: when you say that you’ll be adding socket support to flipbook, do you mean that we’ll be able to create sockets right in the flipbook editor and then drag them around per frame there, rather than on individual sprites…or did you mean just passing the socket list through from the sprites to the flipbook to BP?
For 4.5 it will likely be just aggregating the sockets that exist in the individual frames and avoiding the need for this workaround.
Longer term I absolutely want to allow direct editing and animation/keyframing in the flipbook editor, but I am still waiting on further Sequencer work before adding complex multi-track editing to flipbooks.
As a heads up, the first pass for flipbook socket support is checked in as of commit https://github.com/EpicGames/UnrealEngine/commit/89bad39135e6c75185b100432095f9161cb3792c . This basically surfaces sockets defined in the source keyframe sprites, and doesn’t add any extra authoring ability inside of the flipbook editor, but it should be good enough to play around with.
I am using Unreal Engine 4.12.5.
I am working on a 2d game project.
I made my character with separated eyes and mouth for animating later on. Now I am trying to attach them to the specified point that I wanted.
Sockets are assigned to each Character sprite/ frame with the exact same names. (1 socket per set of eye’s, centered to where the left eye would go)
In flipbook preview, the flipbook plays correctly with the sockets at the correct points.
Blueprint actors are then made for every set of Eyes and the Pivot point is in the center of the left eye, for every eye. (I am guessing, the pivot attaches to the socket)
I have followed this way https://docs.unrealengine.com/latest/INT/Engine/Paper2D/HowTo/Sockets/ but it doesn’t work.
It spawns the Eyes beneath the character.
I’ve followed the way posted here but got lost somewhere in the different node naming’s in Unreal.
I’m sure there is a way for this simple thing but I don’t seem to figure out.
If someone knows, that would be of great help.
I continued working on the problem I posted earlier, following this path https://docs.unrealengine.com/latest...HowTo/Sockets/ and it worked somewhat… but had a lot of problems.
I was trying to figure it out with different combinations and I came to this conclusion (image below).
At first the Actor/ sprite that I attached to the character was glitching hard because it was connected to “Begin Play”, just like the example, but sooner or later I figured the problem out.
The glitching problem was happening because it wasn’t connected to the “Tick”.
Now, another problem has appeared. My enemy AI, passes in front of me and my characters eyes separate from the character, making it look that they are not attached at all.
I know that the problem is in the Y axis, as both my character and the AI have a Y axis location at ( Y: 0.0 ).
Now the solution is to make one of them have a axis of (Y: 0.1 or Y:0.01 …) and upon rotation it goes to either Y+ or Y-.
But for some weird reason they happen to intercept each other and both characters blend as one.
I am searching for the solution as you read this. Is anyone knows why this might be happening please reply.
Thanks for reading.
But from the picture you are doing it wrong. You are spawning every frame an actor! I am amazed how it didn’t crash on you after a few seconds.
What you must do is to spawn only once the actor you want and then the function will do the rest for you ,if you set it up correctly.
Now I do not know why you have issues with the actor following the socket but my first guess , would be a collision setting that is set to block all.
Thanks for replying.
I just followed this tutorial and it didn’t work as I wanted. ( https://docs.unrealengine.com/latest/INT/Engine/Paper2D/HowTo/Sockets/ )
So I did the alterations until I got some result ( the image I posted ). The sprite is connected to the socket.
As for what you are saying about the actor spawning every frame. Is it spawning every frame because its connected to “Event tick”?
Cause connecting it to “Event tick”, worked better than connecting it to “Begin play” as it was in the tutorial.
Unless there is a way you say, to spawn it once upon “Begin play”.
As for the other problem of the Enemy AI flipbook intercepting the Player flipbook, I’ve pin pointed down the problem. Now I just need to fix it.
Thanks for reading.