Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ggez |
I can’t find it under GD
or Mathf
.
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ggez |
I can’t find it under GD
or Mathf
.
Reply From: | AlexTheRegent |
You can program this function if it does not exists
public float RangeLerp(float value, float istart, float istop, float ostart, float ostop)
{
return ostart + (ostop - ostart) * value / (istop - istart);
}
the code needs a little fix:
( x - ostart ) / ( ostop - ostart ) = ( value - istart ) / ( istop - start )
if you islolate x the return must be:
return ostart + (ostop - ostart) * (value-istart) / (istop - istart);
ULViDO | 2022-12-22 17:46