Hi I have attached a gun to the skeleton of my player and made sure it works with the animation, it also fires a bullet projectile when right mouse button is pressed. The projectile is spawned from an arrow component at the end of the gun and I was wondering if there is a way to make a cross hair using UMG and make sure that arrow is always pointing there because at this moment the gun has no movement, just stays in the players hand.
Thanks,
There are two ways to do this. Just assume that the gun and crosshair meet somewhere way in the distance, and point the gun there and every other point it will be a little bit off. The other way is to use the camera’s position and forward vector to do a line trace against the world, and wherever it intersects something fire your projectiles at that intersection point (or a combination of both). Neither will be perfectly accurate.
This is part of the reason that most games will have a firing mode you can toggle that switches the view to be where the gun is pointing.