Moving A Vector point to a new Location

What’s a good way to Move/Modify a Vectors location?

Tl/Dr: Let’s say I have 2 points & a draw a line between those points. Point A & Point B. Let’s say these 2 points Can’t be further then 20 Units apart.
What would be a good way to Move Point B closer towards Point A, so Point B is within the 20M mark, while staying (more or less) on the line. (EI, so the Vector Towards A → B is the same)

I can accomplish this using a Ray Cast Hit Position, however this only works IF Point A has LOS of Point B. Else the Ray Cast will hit whatever’s in between A & B.

You can use linear interpolation formula to get point A closer to Point B, and using a blend parameter between 0 and 1, if the paramter is 0.5 the interpolated point or new A is excatly in the middle of the line towards B.
There are two computed formulas used heavily in game design, 3D Graphic applications and animations, fundamentally in algebra they do the same, which one to choose is dependend on how vectors are implementated regarding to their operation methods:

  1. A + (B-A) * t, where the is the blending factor.
  2. (1-t) * A + t * B, as above t is the blending factor.

In Overwatch both works fine, and a third option exists called Chase Player/Global Variable Over Time/At Rate.

You can also extrapolate with the formulas above allowing t the blending factor to range between -1 and 1. With the third option of chasing the variable extrapolation seems to be restricted and then even if tricky to do, but maybe someone else knows bettter.

^^ I hope that made sense to someone here. Cuz you lost me with that explanation. Thanks though…

Well i were assuming their exists knowledge about lerping or linear interpolation, sorry that i couldn’t unwrap it in full detail, if anyone wants i can do explain more and tell you what linear interpolation actually is. But there are also other resources in the internet like youtube videos i hope that helps you… also would recommend doing so anyways you can solve problems on your own without touching the forum at all.

…that’s something you’d assume someone to know…who’s using this forum? Lol fair enough.
And ya, look at ‘other resources in the internet like youtube’ gee thx. Why didn’t i think of that… But all the same, thanks anyways. Hopefully someone else can chime in, with more “simplistic” wording.

yeah fair enough lol…, i hope you will figure the rest on your own, i should not expect or assume too much…, also that some might work on their reading comprehension and need a full time guide for each step, even that one has a large span on using the workshop, connecting dots is not everyones game… i should stop expecting people should do that… lol, yes life isn’t fair to some… that is my last assumption.

So for anyone curious as to How to solve MY specific dilemma,
What you can do (in Overwatch Workshop terms) is:
Create the 2 Points (A & B) & then Check whether the distance between the 2 points is Greater than 20M (or whatever distance you wanna use). IF this checks True, set:

Point B = Point A + [(Direction Towards (A → B)) * 20]

This will in turn move Point B closer to Point A while staying on the same line (Vector) A → B was.

TL/DR;
You could also use Vector Towards A → B & then Normalize it, however Direction Towards seems to do this automatically. And you could also use Magnitude Of the directional vector of A → B to check if the distance is greater than “specified value”. If that makes more sense to you.

Cheers!

Eh what? You know the magnitude of a directional vector or uniform vector is always 1 so that wouldn’t make any sense. The magnitude of the difference or displacment of A and B would, or also known in Overwatch terms as Distance Between(A, B).

1 Like

oh? Hmm, wonder what i typed in them. Cuz the workshop inspector gave me the same result as Distance Between. Lol oops.

Then you didn’t used a directional vector (which is normalized, e.g. obtained with Direction Towards or Normalize) and instead applied just the displacment obtained either with Vector Towards or Subtracting vector B from A or vice versa. If you would do Magnitude Of(Direction Towards(A,B)) the result will always be 1 regardless of the inputs since as you mentioned Direction Towards automatically normalizes the displacment thats why Direction Towards would yield the same result as Normalize(A - B) or Normalize(Vector Towards(A, B)), and the magnitude of that would ofc also be 1.

1 Like