Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

scale between tow ranges c#

public float scale(float OldMin, float OldMax, float NewMin, float NewMax, float OldValue){
 
    float OldRange = (OldMax - OldMin);
    float NewRange = (NewMax - NewMin);
    float NewValue = (((OldValue - OldMin) * NewRange) / OldRange) + NewMin;
 
    return(NewValue);
}
Source by forum.unity.com #
 
PREVIOUS NEXT
Tagged: #scale #tow #ranges
ADD COMMENT
Topic
Name
4+7 =