Download

Help with my gun projectile!

Okay so i have a gun model and every thing set up perfect except for the projectile.

For testing purposes i used the default FirstPerson one and stole that blueprint for use on my 3rd person character. The issue is the projectile fires where ever the camera is, not where the gun is pointing. Also it only fires one projectile, i need it to fire as long as left click is held down.

Here is a gif so you can see whats wrong
[video]http://i.imgur.com/rqZTrR1.gifv[/video]

Here is the blueprint.

scz3cCn.png

Thats because you are using the ControllerRotation and you Actor Location.

How about you Create a Socket at the Weapon Muzzle and use that as the Spawn Transform Location/Rotation :slight_smile:

I have no idea how to go about doing that :cool: still new but ill mess around for a bit

How would i create a socket on the muzzle of the weapon. That would require it to have a skeleton which it does not. It is just a simple mesh.

go into the weapon/character model and add a socket first.

https://answers.unrealengine.com/questions/5016/where-can-i-find-the-socket-editor-or-how-to-creat.html

I think i got it working now.

This is what i ended up doing
jHuz2J2.png

Now how would i make it only fire when the animation does. right now it fires as soon as you click left mouse down but the animation raises the run then shoots with recoil. I need to get those to sync.

If you want Sync a Specific Animation to execute Code at a Specific Time in the Animation, you can use AnimationNotifies which can Trigger CustomEvents.

You could use a Delay in between your Anim and Spawn Projectile Node…I think…don’t quote me on that.

You can manually delay it, but I think a better a better solution is to use an Event Notify in the animation so you can fire on a specific frame. Reason being is flexibility. If you ever need to change the length of anything you’re going to have to manually adjust the delay. Pretty cool stuff though. It’s just like setting up footstep sounds basically.

AnimNotifies, if you haven’t used them, are very powerful but a little bit confusing at first. If you haven’t watched Epic’s youtube series about animation blueprint, I’d suggest following it all the way through a couple times to reduce the “wth” factor.

And I do almost exactly what D suggested with my firing sounds. I have a gun that has a “charge up” period, so I run a delay that takes in the time of the charge-up sound as the delay period, then spawn the projectile/play the firing sound. A little easier with sounds really I think.