• News

• Industries

• Learning & Support

• Community

• Marketplace

# Math time- Inverting a number?

Hi!

Is it even possible to invert a number like in range 100-0. Like I want to use opacity based on my player health. So if the player health is say 99 the opacity would be 0.01, and if the health is 50 the opacity would be 0.5

What is the best way to do this and if people like math, they could help me with this? Or should I look into changing the way I approach this?

1 - (currentHealth/maxHealth)

Another option is “Map Range” with the In Range set to 0 - 100, and the Out Range set to 1.0 - 0.0

Inverting a result can also be accomplished by multiplying by -1.

I think this will do me fine thanks man! I needed this for other types of stuff as well

Am not a math expert but try this:

``````
**1 - (currentHealth / MaxHealth)**

``````

So if your current health is 40 and max health is 100 then it will be like 1 - (40 / 100) which is 0.6

If your current health is 600 and max health is 1000 then again it’ll be like 1 - (600 / 1000) which is 0.4

Yeah I realized that when the other guy said that. Math skills have been unused for some years now