Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Adam Z on November 25, 2018, 05:29:36 PM

Title: How to invert a float?
Post by: Adam Z on November 25, 2018, 05: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.
Title: Re: How to invert a float?
Post by: DanielThomas on November 25, 2018, 08:33:32 PM
Unless I misunderstand, '100 - slider value' sounds correct?
Title: Re: How to invert a float?
Post by: Adam Z on November 25, 2018, 09: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.
Title: Re: How to invert a float?
Post by: Athin on November 25, 2018, 10: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.
Title: Re: How to invert a float?
Post by: Adam Z on November 26, 2018, 10:26:22 AM
Beautiful!
Title: Re: How to invert a float?
Post by: Thore on November 26, 2018, 11:45:52 AM
Just 100-x will do the trick. 100-54 = 46.
Title: Re: How to invert a float?
Post by: terri on November 26, 2018, 03: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
Title: Re: How to invert a float?
Post by: Adam Z on November 26, 2018, 03: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.
Title: Re: How to invert a float?
Post by: Thore on November 26, 2018, 05:24:01 PM
You won’t need this in this case; but else, you can find a trove of additional actions in the ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181). 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.  :)