I’m looking for something that kinda sorta resembles a lerp (or maybe a lerp would work but I don’t know what kind of formula I would use to implement it).
I want to get my mouse on screen coordinates (X and a Y) and compare it against my player character. I need to calculate the distance from my mouse to my player but ONLY up to 200 units, then return the relative X and Y.
I have mostly implemented this already, and clamped the floats at 200. So if my mouse is on my player it reads X0-Y0. If I go straight up or straight down then Y will span between -200 and 200 perfectly fine. The same goes for X when moving left and right.
HERE’S THE MEAT OF THE PROBLEM:
If I move far enough up/down AND far enough left/right, then my returned values look something like X200Y200 or X150Y-180 (you get the point). Im wanting a circular radius. Of 200 units, not a 200x200 hitbox. Is there some sort of function (or even a mathematical formula) that can effectively blend between X and Y? Picture a sliding scale that’s either all of X or all of Y. Or maybe it’s 75% X and only 25% Y ect.
At face value this sounds like lerping (or inverse lerping?) would be what I’m looking for, but I’ve only seen it used to scale between two seperate values on a linear scale, I’m not sure if there’s a way to scale between 2 seperate variables that may potentially have the same value. Any advice would be greatly appreciated