Shoot 3D projectile at mouse position

Hey, kinda new to UE5.4 and I’m trying to do a first person shooting range game.

To do that I have a fixed camera pawn that at the moment shoots a Line Trace where I click. My objective with this is to make an aiming system similar to Arma’s, where the projectile is shot in the direction where the mouse is located when clicked.
I’m kinda stuck on changing the line trace to a projectile, already tried copying the projectile spawn mechanic from the First Person Template but it didn’t work, the projectile always goes foward.

Any ideas on how to do that, maybe somehow make a skeleton socket that follows the mouse location, any help would be apreciated

Are you struggling on making the projectile shoot to where the line trace is pointing at? If so, all you really need to do is just breaking the Out Hit pin and subtracting the hit end location from hit start. That would give you a vector which your projectile should follow. You can turn that vector to a direction indicator by normalizing it using the Normalize node. If you want to get the angle between that vector and the (x = 1, y = 0, z = 0) unit vector (which represents the +x direction and is considered to point at 0 degrees around z axis), you can simply calculate that by using the Dot Product & atan (degrees) nodes. And you can get both the yaw and pitch rotation differences seperately by plugging their x - y and x - z pins (which you can expose by splitting the vectors’s output pins) into make vector nodes respectively and then comparing them using the Dot Product & atan nodes. This way, you can detect the exact rotations needed to transform the projectile before propelling it to it’s relative forward vector.

Note: Since the atan node doesn’t return a negative value, you can see if the result needs to be inverted by being multiplied by -1, by getting the vectors’s cross products using the Cross Product node. It would need to be inverted if the cross product is in the negative axis directions (either left or down)

My explanation above was to give you the answer on how to get the values you want from the line trace node like you asked. And even though there are other ways to do it, I wanted to explain the most mathematical way to have you grasp the context. But if the projectiles need to be shot at the direction of where the player is looking, you can just use the Get Control Rotation node!

I hope I understood your objective correctly and you find this helpful :blush: