playMaker

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

Adam Z

  • Full Member
  • ***
  • Posts: 207
How to invert a float?
« 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.
« Last Edit: November 25, 2018, 10:04:35 PM by Adam Z »

DanielThomas

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

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: How to invert a float?
« Reply #2 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.
« Last Edit: November 25, 2018, 10:03:27 PM by Adam Z »

Athin

  • Full Member
  • ***
  • Posts: 163
Re: How to invert a float?
« Reply #3 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.

Adam Z

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

Thore

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

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: How to invert a float?
« Reply #6 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

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: How to invert a float?
« Reply #7 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.

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: How to invert a float?
« Reply #8 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. 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.  :)