crateing a target that fires where the mose in clicked?

I’m trying to make my player shoot at the mouse location depending on where it is in the world. I have a very basic setup that I have been changing to see if I could come up with, but the projectile doesn’t hit where the more location is, I did some research and some one said is was my mouse is set up in my HUD in 2d but I need it set up in world space but my understand is very limited. I would like the player to shoot the projectile where the mouse is located e.g on the roof top on the ground, the player has the same control as the 3rd person template and the camera only rotates and the X and Y plane. any help would be grateful
I have found the covert mouse to world location but I have no idear how to set it up. and where do I set it up in my HUD or in something ells?
d5891b10ba45cb256110d9637d77ed141101d362.jpeg

f9d9687b0ddffbf3f015bd2b92cc0b1ee22233be.jpeg

I’m just getting started with UE 4 but in other enviroments like XNA or LibGDX there is something called RayPicking or simply RayCasting.
They’re right if they say, you only got 2D-Coordinates from your Mouse-Input. You only get the Position on your Screen.
What you want is a Ray that starts from your mouse with the direction of your LookAt.
With this ray, you can check intersection with a 3D-Object. You can check for multiple ones but you will want to have the closest object intersected.
Now you can get the 3D-Position of the intersection, so you can let your character shoot at this very position

thanks a lot that is a big help Justjim, you have a made the confusing some what less confusing, I am now looking into line traces and I kind understand what you are saying, using my picture above my line trace should start at the centre of my red target and finish where it is point to witch is the box, then one would crate a second line trace what starts from the player to the point of impact on the fist trace, or spawn and projectile to the location

Yes that sounds right.

  1. Get the point your Mouse-Ray is targeting at.
  2. Get the Vector (Target - CharacterPos) <- This is the Vector which points from your Character to the Target.
  3. Let the bullet move along this line

I think have the line traces going from my “mouse” to the real world location then my player to the mouse hit location but, I am having trouble with getting the line trace from my HUD to my player control, I cant seem to get them to line up, I found a video about it where he did some math with the Viewport size and mouse location and a few other things in the HUD but that didn’t, I have a play around with it as well tried to do some research on it but nothing seems to work out for me and the info I can get is scattered. I came come up with is, is the values on my X,Y,Z are different to the X,Y location from my HUD to the player controller. so getting the Mouse Screen location and the Value under that location the world seems to involve some maths al well(witch isn’t my strong point), how would one work out how to get the values I need. or point me in the direction of a example of it.

Here is something I had done to project a 3D cursor to the scene from the cursors location on the screen, it might work for you:

edit: this works better if Show Mouse Cursor is enabled in your Player Controller

thanks for the help much appreciated i’v seen played with a similar setup like the pic above, got it working however, in my HUD I was using get “mouse position scaled by DPI” when that didn’t work I was using other nodes like Click under cursor and so on, then trying to figure what to do with the values, when all I needed was to use the “get mouse position” in my HUD, I played around with it before but i must of done something ells. it was much harder than I was trying to make it, very silly.

after all that I ended up scraping my HUD anyway as i found that I could tell what I was targeting, now I can tell what I can targeting and if there is a object in the way
I have what I think is a basic version of my targeting system
the red ball symbolizes that there is a objet in the way the green is what the player is targeting at if there is no red ball you have a clear shot,

I have made the player(in a very basic forum) and camera rotate so the face forward when the player is targeting but after they have done this I want the camera to not rotate until they are finished targeting/firing, but I don’t know how to do this, the stoping the camera from rotating after I have told it to rotate I am struggling with. I have tried to clamp the rotation but I can get the rotation to stop after the camera has moved to clamp it

dose the Exce (white line) work in order? such as once I have told it to rotate using the set control Rotation cant dose every thing after Exce line work under those values?
ab850e82d9304bc5c89478160b15127f455716ca.jpeg