Get coordinates of where player is looking

Right click → Event is trigerred. Actor shall then be placed where the player is looking at. I am using 1st person blueprint.

You will have to do a line trace. In this case a single line trace by objects should be the best option.

Since you want to get the position of the player looking at: Get the camera location and the “Get forward vector” of it. Multiply the forward vector by the length of your trace (in which range should it find the position?). Plug the current position into start and add the new vector on top of your position and plug that into target.

As result you get a hit result which contains a “location”. Those are the coordinates you’re looking for.


Thanks , how does multiplication affect length? i.e. x2 = 2 meters?

Q-6FtPvA posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4 I tried this , It doesnt go through the line trace, I want to listen only for ground

That’s because of vector math. The “GetForwardVector” will return a normalized vector. That means he is 1 unit long. For example (1,0,0) or (0,1,0).

If you now want to trace 5000 units far, you will want to multiply this vector with 5000. I hope that makes sense for you. Maybe draw a 2D vector and a paper that is 1 cm long and think about tracing 20 cm far now.

The start point of that 1cm long vector is your trace startpoint. And to get the end point you will want to add the 1cm long vector to the start point. If you want a 20 cm far trace, you will want to add 20cm long vector to it.

The exact x,y,z values of the normalized vector are not important.

My bad , it works