Location of the point on the edge of a scaled object

I have a cube of a given length, width, and height.

I mark the extremes of this cube as xLow, yLow, zLow, xHigh, yHigh, and zHigh.

I have an object on the corner of that cube at (xLow, yLow, zLow)

If the initial scale of the cube is h, and I add a value to the scale denoted as d, what is the new (X, Y, Z) position of the object on the corner such that it stays on that corner?

I created a demo for this problem:

I tried the following equation:

cube.position.set(xLow + xLow * d, yLow + yLow * d, zLow + zLow * d);

However, this only works if the object’s initial scale is one. Otherwise, the corner object does not follow as the object scales.

Hello. @Michael_Nicol .
How are you?
I have seen the codesandbox and there is a small issue in your equation.
I think the equation should be cube.position.set(xLow + xLow * d / h, yLow + yLow * d / h, zLow + zLow * d / h);
Here, h is initialscale.
Thanks.

1 Like