I have two positions, they are represented below as x1, y1 and x2, y2. 'dist' is the straight distance between the two I have already using phythagoras.
sqrt((x1 - x2) ^ 2 + (y1 - y2) ^ 2)
I'm trying to move x1, y1 closer to x2, y2 by 1 unit. x1', y1' refers to this new location.
I think it ought to be something like this.
x1' = (x1 - x2) / dist y1' = (y1 - y2) / dist
I then need to apply a function to this distance, for example to make it reduce as the distances are moved further apart.
x1' = 1 / ((x1 - x2) / dist) y1' = 1 / ((y1 - y2) / dist)
Is this all correct?