# playMaker

### Author Topic: How to invert a float?  (Read 874 times)

• Full Member
• Posts: 152
##### How to invert a float?
« on: November 25, 2018, 03:29:36 PM »
Hi,

So I have a Strength slider, 0 to 100. But my characters base model was modeled at his muscular size (so Blend Shape 0), and the Blend Shape for his normal body size (skinny) is at 100. So currently when the Strength slider is at 100, the model is at his skinny body size.

What I'm trying to do is reverse the float; so when the slider is at 0 the Blend Shape is at 100, and visa-versa.

Any thoughts aside from editing the model?

Thanks.
« Last Edit: November 25, 2018, 08:04:35 PM by Adam Z »

#### DanielThomas

• Beta Group
• Full Member
• Posts: 134
##### Re: How to invert a float?
« Reply #1 on: November 25, 2018, 06:33:32 PM »
Unless I misunderstand, '100 - slider value' sounds correct?

• Full Member
• Posts: 152
##### Re: How to invert a float?
« Reply #2 on: November 25, 2018, 07:56:16 PM »
Maybe to clarify; if the slider is set to 100, I would like my Blend Shape set to 0.

My character was modeled at his muscular size, and the Blend Shape for his normal body size (skinny) is at 100.
« Last Edit: November 25, 2018, 08:03:27 PM by Adam Z »

#### Athin

• Full Member
• Posts: 126
##### Re: How to invert a float?
« Reply #3 on: November 25, 2018, 08:23:34 PM »
If I understand it correctly you can do some quick math on it as a work around.

Take your input number (Ex 54) then minus 100 from it.(54-100= -46).  Take that result and multiply it by -1 (-46 * -1 = 46) and there is your inverted number.

Hope that helps you.

• Full Member
• Posts: 152
##### Re: How to invert a float?
« Reply #4 on: November 26, 2018, 08:26:22 AM »
Beautiful!

#### Thore

• Sr. Member
• Posts: 353
##### Re: How to invert a float?
« Reply #5 on: November 26, 2018, 09:45:52 AM »
Just 100-x will do the trick. 100-54 = 46.

#### terri

• Sr. Member
• Posts: 373
##### Re: How to invert a float?
« Reply #6 on: November 26, 2018, 01:31:37 PM »
this one is pretty straight forward, but sometimes it isn't, and in those cases you can use the "float remap" action

• Full Member
• Posts: 152
##### Re: How to invert a float?
« Reply #7 on: November 26, 2018, 01:36:25 PM »
this one is pretty straight forward, but sometimes it isn't, and in those cases you can use the "float remap" action

I don't see the "Float Remap" action.

#### Thore

• Sr. Member
• Posts: 353
##### Re: How to invert a float?
« Reply #8 on: November 26, 2018, 03:24:01 PM »
You wonâ€™t need this in this case; but else, you can find a trove of additional actions in the ecosystem. Just install the package, then open it from the menu point of Playmaker at the top of Unity (or Alt+E, I believe), and look for what you might need.