If anyone can help with this math rotation problem it would be great.
Here's the problem:
I'm making a humidity gauge with a rotating arrow based on RL weather
numbers. Using llHTTPRequest/http_response I assign a float number
to a variable, for example: "34.4".
The dial graphic background was created in a graphics program, so the
ticks are not perfect, but they're essentially 2.7 degrees apart around
the dial. .
To point at O% humidity on the dial the arrow (a stretched cube) is
turned 231 degrees on the Y axes. To point at 100% humidity the arrow is
turned to 140 degrees on the Y axes. 50% is at 4 degrees on the Y axes.
So the way I've got it working so far is this:
I assign the http_response to a var:
float n1 = (integer)n;
Then I have a long list of if clauses, which I've only bothered
to assign whole numbers so far:
if(n1 == 0) n1 = 231.0;
if(n1 == 2) n1 = 236.4;
if(n1 == 3) n1 = 239.1;
if(n1 == 4) n1 = 241.8;
...etc...
if(n1 == 97) n1 = 130.9;
if(n1 == 9
n1 = 133.6; if(n1 == 99) n1 = 136.3;
...etc...
And then...
rotation hand_rot = llEuler2Rot(<1 * n1 * DEG_TO_RAD, 0, 0>
;This works...but there must be a better way; a way to derive the range of
SL Y axes degrees from the float numbers mathematically instead of
foolishly with a calculator manually as I have done.
Well...if anyone knows what the hell I'm talking about and can
offer some light...I'd be stoked!
- Infrared