How do I find the distance to a target along the players aim, if the player is not looking directly at the target?
Ive set up a targeting function that currently gets the closest target within an FOverlapResult.
I need the target closest to the players aim, not the player themselves.
I think(mathematically) this is a matter of finding the longer cathetus of a right angle, where the hypotenuse is the actual distance to the target.
Im not familiar with what functions, if they exist, would do this.
Bit of an update:
I don’t know if its intended, but FMath::PointDistToLine does not actually get a point along the line.
It seems to get a point on the opposite side of the targetpoint from the line.
Fortunately, I was still able to make some custom code based off this to meet my needs.