- Home /
Making slider match health when values are different.
HI, this is probably a simple equation but my Math has escaped me today. I problem is I have created a HUD for a survival game through UI filled Images, However the fill area of some of my sliders is not visible. My health and stamina in the game are held in floats and are valued between 0 and 100. however my image fill or slider value is only visible between 0.07 and 0.42. I basically need the slider to move corresponding to the health and stamina floats.
public float playerStamina = 100; private float maxStamina = 100; private float minStamina = 0;
public float playerHP = 100; private float maxHP = 100; private float minHP = 0;
public Image hpHUD; public Image staminaHUD;
private float maxSliderValue = 0.42f; private float minSliderValue = 0.07f;
anyone that can help with equation it would be great. Thanks in advance.
Your answer
Follow this Question
Related Questions
Circular motion via the mathematical circle equation? 4 Answers
How to move slider same amount with different max values when moving it by a percentage Unity 1 Answer
health bar position formula 3 Answers
Healthpickup isn't working 1 Answer
I am trying to take away some health from a slider using a coroutine, but it takes away too much 1 Answer