Projectile doesn't hit the centre

​​Hey, I’ve been working with a ballistics system and I’ve got a system that allows the user to shoot. The bullet originally came from the centre of the screen, however I wanted it to come from the gun which I managed to do but it doesn’t shoot at the centre of the screen I was wondering if anyone had any idea of how to make the bullet fly towards the crosshair.

I posted my blueprints and a demonstration to give some insight. Thanks in advance!



Hi man,
break down your blueprint and add some visualizations, draw debug sphere and lines!

Beware that the actor rotation can influece the calculations for the rotation of the gun
Here a quick test,
On the left the Gun dont aim to the impact point of the camera linetrace, (Because rotating the actor mess up the thing )
Onn the right, Gun Aim perfectly to impact point, wherever i rotate, (because i subtracted the actor rotation from the calculations)

To be clear : instead of using the Z in the Red comment, i added some nodes in the green comment

The cross hair is not necessarily under Camera Forward Vector.
also, camera forward vector is prone to bugs when moving/changing direction.

Test the shooting by setting your line trace to persistent debug, then move left to right while shooting. You should see the line trace some times go off from where expected.
activate slowmo and you may even see the camera acting up.

Usually, you use deproject screen to get the vector (end point).

Then you get look at between gun muzzle and the world point.
And you use that as the vector for line tracing.

I always use the following with no issues. TPP/FPP/ADS

1 Like