How do I shoot where the camera is pointing ?

So basically I am working on a ThirdPerson Shooter game in Unreal Engine 4.27
And the problem that’s been bothering me too much is shooting…
I have a pistol and when I shoot, it plays the shooting animation
But when I look up and shoot… the player shoots forward
I have used Aim Offset but it only works when I am in ADS
I don’t want my character to go into ADS mode when he shoots every time, I want him to Hip fire when not in ADS
Is there a way to make the player shoot upwards when not in ADS?
Thank you.

LineTrace from camera, and shoot towards the hit location

Hi @Sath_Wick!

Here is a great Non-Epic affiliated tutorial that demonstrates the basics on using line tracing from your cameral to create a FPS:

Unreal FPS Tutorial: Making a First Person Shooter

I hope the above solution works for you!

1 Like

Important side note for line tracing and third person firing mechanisms is you will require TWO line traces for third person perspectives. You can convert screen space on a forward vector to your desired distance to determine a world location to get perfectly centered line traces forward from your reticle/camera and another from the barrel of your weapon or wherever to the world location of the first line trace.

The result would be a starting line trace to where your looking from the camera view and a final line trace from a reference point location on your weapon to that first end point. You can use a small sphere component and place it in front of the weapon to get that actor location and set it hidden in game to get a persistent actor location reference without the rendering overhead.

Otherwise it’ll never line up, perform or look right. FPS is easy… one line from the camera forward x distance. third person requires a little finesse. This same setup also works in “ADS” or first person perspective, but it has its trade offs that will become apparent when shooting at things very close or when a tree or foliage or whatever is blocking the line trace channel.

This can be mostly fixed by moving your starting location of your first line trace forward to about where you characters muzzle is depending on how far away your camera is from the character.

I am so sorry I didn’t elaborate the question correctly, by “the player shoots forward” I meant, the player plays the shooting animation in forward direction. When I look up and shoot, the forward shooting animation plays. Is there a way to make the player play the shooting animation in the direction I am pointing to? Thanks

That’ll be Aim Offset boss.

You need one for idle hip and one for ADS. The Idle hip should have pitch rotation limits though. 65 to -45 or so.