Converting a value from one range to another

The “range” function is used to transfer a value from one range, for example, from 0 to 1000, to another, for example, from -1 to 1. To quickly get a value in different ranges, we can define a simple function.

The equation for converting a value from one range to another is as follows:

Let’s define the function according to the equation:

Now we can easily use it to get a value, for example, from the range 0 … 10 to the range -1 … 1 for the X coordinate of the active object position:

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments