Find distance in a certian way

Hi, is there a way to find distance this way

  1. Forward distance from two vectors? So left and right wont take in count
  2. Left & Right distance from two vectors? So Forward wont take in count

Currently i only know to calculate corners and compare that, and that works fine but seems like a trash way to go about it and waste of performance

What if they are opposite?

Could you elaborate, perhaps find an image that illustrate what you want?

1 Like

Opposite how? :slight_smile:

As If the forward vector of both actors are facing opposite direction. (I imagine that is what you want)

Oh, sorry it should only take in count of forward vector from A not B
So Imagien a line plane for forward A, The distance i want to find would be the “Closes point at line plane where input is B”

If that makes sense, but without (hopefully) using that method

Maybe this will be helpful:

2 Likes

Yes. I remember you from the round corners topic. :crazy_face:

Hope this illustrate what (I think) you asked for:


Result:
FindAdjacent


In case you want to investigate further, what I did was basically construct a triangle:

  1. Get the angle between forward vector to direction to B.
  2. Get dista form A to B (this would be the hypothenuse)
  3. Then found the adjacent side length: Adjacent = hypothenuse * cos( Angle )
  4. Finally from A i projected a point with ForwardVector * Adjacent.

image

3 Likes

Worked like a charm, thank you!