Download

Sockets and projectiles

Hello guys,

I have a few questions for you good people. I am working on a 2d sidescroller shooting game which is my firs ever btw. I have made a sprite character with jump, run and shoot flipbooks. I added a static mesh inside character bp with a socket, to spawn projectile. I found out how to make my char use run anim when he runs and jump anim when he jumps. Its working fine. Also when I press left mouse it shoots projectile np, BUT- I dont know how to adjust projectije spawning position. It shoots where I want but it comes out not from the gun but below the barrel. I tried to move the mesh up in the character bp but it does nothing. And moving socket in the mesh editor also does nothing. In game the projectile still shoots from the same spot. How do I make the bullet appear exactly where I want on my sprite?

Also my shoot animation doesnt work when I press left mouse. It kinda just resets my chars idle animation so maybe it just ends after one frame? Idk.

Please help! Cheers!

Not sure to understand fully what you mean, but I will try my best to answer properly !
Once you set up your socket in the Mesh Editor, be sure to use the node “Get All Socket Names” where the target input is tied to your weapon, then filter the resulting array to the socket’s name you are looking for.
Then spawn your projectile on a “Get Socket Location” node and you should do fine !

Alternatively, more tediously and less versatile, you can simply create an invisible volume attached to your weapon, at the exact location you want the projectile to be spawned.
Then, spawn your projectile at your box’ location with a simple “Get World Location”.

Hope I helped a bit !

Hi. My character is a sprite, a capsule and a sphere. Sphere is invisible, with no collision and has a socket. I tried to adjust the projectile spawning point by draging the sphere around in components tab on my character BP. It didnt work. Then I went to the sphere mesh edidor and tried to move around the socket that is spawning my bullet. In game it was still spawning from the same point.

The sphere is as big as my sprite though. Ill try to make it small and put it right where the weapon is. Im not sure I fully understand how to do the first way in your post. Im very new and clueless at many things. Ty for reply!