Topic was automatically imported from the old Question2Answer platform.
Asked By
redstonecreeper8
This might be a dumb question. But I want to convert an x-value between a positive integer and negative integer into a degree value between 0 and 360. (or a radian value between 0 and 2pi) For a radius of 2000, 2000 would be 360 degrees, 0 would be 180 degrees, -1000 would be 90 degrees, etc. (Imagine a line wrapped around a circle.) Maybe I’m just extraordinarily dumb because my brain just can’t figure this out.
Take a look at range_lerp(). That’ll map a given value within some input range to a corresponding value within some output range.
I’m not sure I follow your example exactly, but it seems that you’re trying to map a value in the range of -2000 to 2000 to the range of 0 to 360. Here’s an example of that: