How to get percentage of a UI slider from a given position?

36 Views Asked by At

let's basically say that I have a UI slider in my game, with :

min : $60$

max : $140$

position percentage : $40$%

position : ?

how do I calculate the position using what's given above ? I tried some equations I found in the internet and the closest I could get is this one :

position = (percentage * (max - min) / $100$) + min

however it is still not working correctly

1

There are 1 best solutions below

0
On

The distance from 60 to 140 is 140- 60= 80. 40% of 80 is (80)(.40)= 32. So 40% of the way from 60 to 140 is 60+ 32= 92. That appears to be just what you did, "position = (percentage * (max - min) / 100) + min". Why do you say "it is still not working correctly"?