#### helpless_coder

##### Member

[CLOSED]

Got help from the Math discord, and they came up with this solution:

[OLD]

I'm sorry if I don't explain this well. Keep in mind that this is all 2D.

I want to have a formula for measuring the distance between two points in fake 3d space, and but I have no idea how to do it.

Let's say I want the cube to be 64 pixels thick. Using lerp I just change the last argument until it looks right. But that's not good enough.

How can I establish a uniform unit of length using the parallaxing background method, so that I could give an input of pixels and have it look right?

I imagine a script to look something like this:

Heres an image to hopefully illustrate the issue

Got help from the Math discord, and they came up with this solution:

GML:

```
if (relative != noone)
{
var start_point = argument1;
var end_point = argument2;
var input = argument3
if (input > 100) input = 100;
else if (input < -100) input = -100;
var distance = 400 * (power(input - 100, 2) - power(100, 2)) / (power(input - 100, 2) - power(200, 2)); // Thanks Ann
return lerp(start_point, end_point, distance * 0.01);
}
```

I'm sorry if I don't explain this well. Keep in mind that this is all 2D.

I want to have a formula for measuring the distance between two points in fake 3d space, and but I have no idea how to do it.

Let's say I want the cube to be 64 pixels thick. Using lerp I just change the last argument until it looks right. But that's not good enough.

How can I establish a uniform unit of length using the parallaxing background method, so that I could give an input of pixels and have it look right?

I imagine a script to look something like this:

`scr_fake3d( thickness, draw_length ) // where draw_length is the depth where the box is drawn`

Heres an image to hopefully illustrate the issue

Last edited: