I am trying to figure out a way to cause the distance of ObjectA from it’s origin position to directly control the angle of ObjectB. The player controls the position of ObjectA by clicking and dragging with the mouse and I have a hinge joint with max limit controlling the angle of ObjectB.
So for example, the default distance of ObjectA from it’s origin is 0, so the angle of ObjectB stays at 0 degrees. But if the player drags ObjectA the max distance away from it’s origin (it has a radius of 5), I need the max limit of ObjectB to become 90 degrees. But I also need all of the angles in between to be represented as the player moves through them. So when the player moves ObjectA to half of it’s max distance (2.5 units away) the angle of ObjectB will be 45 degrees.
I am not really sure how to search for this cause I’m not sure what this effect would is called. I started looking into Lerp functionality because it seems to be able to represent gradations between two variables, but I’m not sure that it is what I am looking for since from what I have seen, it uses a time variable. Rather than having the value change over time, I need mine to change according to the player’s actions. So even if someone doesn’t have a direct answer for me, I would appreciate being pointed in the right direction just to get me started on what I need to search for. Thanks in advance for any help!