This question was
closed Feb 14, 2018 at 03:48 AM by
grimmdeveloper for the following reason:
It's hard to explain, I don't feel as though I'd find an answer to my problem.
Question by
grimmdeveloper · Feb 14, 2018 at 03:37 AM ·
distancepercentage
Range Value based on Distance?
I have a dillemnia measuring fall off within a percentage and range, taking into account user distance.
Say I have a value of 931 and a Range of 0-50meters, the closer to 0 the full 931 value while further would be 0 in value, but also to incorporate percentage ranges, so the value can be between 100% at 0m and 53% at 50m. So far I got most of it besides the percentage ranges.
Mathf.RoundToInt(((r - d) / r) * vo);
Where r is max Range, d is player Distance from the point, vo is the variable. Which yields fantastic results, but doesn't supply in percentage.
Comment