- Home /
How to convert a range value in another?
Hello,
To be more specific, I'll use an exemple.
In my code, there is a float type variable (var startFloat) that is clamped between value 1 and value 100. The possibility is a range from 1 to 100.
From this value, I want to convert (var finalFloat) to an another range from 0 to 101.
So :
if startFloat = 1, finalFloat = 0
if startFloat = 100, finalFloat = 101
if startFloat = 50, finalFloat = 50
if startFloat = 12, finalFloat = ???
Thank you for helping.
Answer by vagos21 · Mar 05, 2013 at 12:11 PM
so you want to convert a float from range A-B to range C-D?
here's a link, it's already in javascript style, so all you have to do is change these variable declarations from Number to float i guess :)
Your answer

Follow this Question
Related Questions
Positive to negative not working? 1 Answer
Variables and ranges in javascript 2 Answers
Small value range from Input.GetAxis with XBox360 joystick 0 Answers