Get the same old location in 2 new locations

23 Views Asked by At

I'm having trouble getting a new location that used to be in 2 old locations, but in 2 new locations.

Here's an example of the 2 new locations:

const loc1 = {
    x: 0,
    y: -50,
    z: 0
}
const loc2 = {
    x: 0,
    y: -60,
    z: 0
}

And here's an example of an old location:

const oldLoc = {
    x: 1,
    y: -40,
    z: 10
}

I have tried multiple methods such as the "for" and "forEach" method to go through both locations and calculate a new location using the old one, but none of them worked.

0

There are 0 best solutions below