Can someone good at math give me a formula for how to set the layout scale to something based on the distance between two points? The layout size is 3840x3840, and the window size is 1920x1080, so when the objects are right on each other, the layout scale should be 2 max, and when they're furthest away, it should be 0.5 min.
So far the best I have is this, except it gives the opposite scale effect I want, and zooms out too much, and has nothing else to do with the measures I need:
Every tick: Set layout scale to distance(1CharBox.X, 1CharBox.Y, 2CharBox.X, 2CharBox.Y)/1000
Edit: Oh, okay, I figured it out. Sorry. Was easier than I thought. In case anyone else cares:
Every tick: Set layout scale to 1000/distance(1CharBox.X, 1CharBox.Y, 2CharBox.X, 2CharBox.Y)
I also made a global variable called Layout_Scale that's always set to LayoutScale. Then:
Layout_Scale < 0.5 : Set layout scale to 0.5
Layout_Scale > 2 : Set layout scale to 2