Problem Sidescroller 3D shooting "arrows"

I’m kinda new on UE, so any help Is very welcome.

I want to shoot the arrow on the mouse direction only to the Z and Y directions, Up, Forward etc (Black in the picture)… But when I change the mouse position goes to the X (in red) deeper, how can I change that?


Sorry for my bad english, and thank you in advance. :slight_smile:

The simple option to fix this would be to take the location from the ‘Break Hit Result’, break it into it’s separate float values and then make a new Vector3 that use the Y and Z from the ‘Break Hit Result’ and then just set the X value to the X location of the player pawn.

This though is going to have one problem, as you target things further from the X depth of the player pawn you are going to see that the arrows aren’t going towards the mouse position. In order to fix this I would suggest taking the hit location and calculating where it would be if it was extended to the player X depth.


Math would look something like this

Mouse Hit Direction = Normalized Vector of (Hit Location – Camera World Location)
Target Location = Mouse Hit Direction * (Camera World ‘X’ Location / negative Mouse Hit Direction ‘X’) + Camera World Location