"Bullets" from gun go into the sky, not where the MuzzleFlash socket is.

Hi. I’ve been trying all day to figure this out and would appreciate it if anyone could help me out.

This is what my character BP looks like (the part relevant to this anyway):

And this is what my weapon BP looks like:

And this is how the “bullets” are firing:

I have an Aim Offset and it also happens when I have “Use controller rotation yaw” checked and unchecked.

Any help is much appreciated.

You probably want a ‘Get Forward Vector’ instead of that second ‘Get Socket Location’, something like this:

Hi. Thanks. That’s fixed the problem with the line going into the air. Seems like the problem is almost solved, except the line is now coming out of the left side of the gun, other than that, it seems to be fine. So it looks like something needs to be rotated 90 degrees?

Thanks again. :slight_smile:

Yes, I forgot to mention that, you may want to look(and change) the rotation value of the ‘MuzzleFlash’ socket(In the skeleton you created it) to make sure its forward vector points forward. :slight_smile:

I tried changing the MuzzleFlash relative rotation in the rifle skeleton, it didn’t alter the line at all. I even tried random numbers, it didn’t move at all. Any ideas?

Thanks. :slight_smile:

The last time I had a similar problem with a socket(changing its rotation on the skeleton did not change the value in GetSocketRotation->GetForwardVector) the problem was the name of the socket, so one idea I have right now is just to check if the socket name is exactly ‘MuzzleFlash’ :slight_smile:

I triple checked all references to MuzzleFlash and they are all spelled correctly. I’m not sure what could be the problem. Is there a “hacky” way of simply rotating the line 90 degrees?

I usually create an arrow component and attach that to the socket, then i use the transform of the arrow to determine the linetrace orientation. That way i dont have to worry about sockets to much (cause im not an animator ive got little idea how to use that stuff lol).

Hey guys. I figured it out. I added a “get right vector” and now it shoots straight.

Thanks again for your help. Here is the BP for reference.