Gun not shooting straight

I am making this gun in ue4 but I am having an issue. The gun is basically not shooting straight, I tried to put together a photo here to try and explain my issue: The green circle is where I want it to shoot, the red is where it fires if I shoot one and one bullet, and the yellow circle is where it fires if I spam fire it. This is the tutorial I am using for the ads And this is the one for firing the gun . The muzzle is perfectly centered as seen here: Screenshot - 26884d60ba0deda31ad91a2bd4954f7b - Gyazo and here is the firing: Screenshot - cd0ee1c19bb0aa81f19d67dfd0f224dc - Gyazo the player controller: Screenshot - 62f5218ba394267f61801ff7dad1236d - Gyazo and the muzzle rotation function: Screenshot - 50bbcf42f0cc8f54eabc30c88aeef866 - Gyazo
Any way of help would be greatly appreciated :slight_smile:

If the issue is that it’s not firing straight it’s that what ever Aim Object is in your setMuzzleRotation function is in not aligned with your gun. Since it’s a first person shooter I can only assume you want bullets to go in the direction the player is looking. Try setting MuzzleRotation to controller rotation or even the player camera world rotation.



The point is for the bullet to shoot out from the Muzzle Socket on the gun and then go straight forward

This Screenshot - 26884d60ba0deda31ad91a2bd4954f7b - Gyazo

Well if you insist on it going in the direction of the muzzle, the problem is that the socket is not rotated correctly. Otherwise you could use it’s rotation instead of having to calculate another rotation.

In the static mesh editor go to the socket manger and select the muzzle socket. Set it’s rotation to something that make the red axis or forward axis point forward.

That way instead you can just use the socket of the mesh.

Thanks but i have already tried that,but I think I just found the problem, the aim object in the function is not referenced anywhere. So I’ll try and experiment a bit with that and then I’ll see how it goes. I appreciate the help :slight_smile: