Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Raknill on October 23, 2016, 10:13:01 PM

Title: Convert float to... float[SOLVED]
Post by: Raknill on October 23, 2016, 10:13:01 PM
So, I thought this might be easy (you've probably heard that before), but I'm hitting a roadblock.

Basically, I have a slider that has it's value set between 40-80. I want to control an animation using Set Animation Time, which requires a value between 0-1.

I'm looking to sync the animation with the slider, basically taking the sliders float value of 40-80 and converting that to a 0.0-1.0 to control the animation. 

I tried messing with Convert Float to Int, and then converting that back to a float, but I'm not getting the synchronous behavior I need. I think this should be relatively simple, but I'm here to learn.

Thanks in advance for any help, let me know if more explanation is needed.
Title: Re: Convert float to... float
Post by: Raknill on October 24, 2016, 12:59:22 AM
Just thought I'd simplify my question; I want one float that is clamped between 40-80 to control the interpolation of another float that is clamped between 0-1.
Title: Re: Convert float to... float
Post by: djaydino on October 24, 2016, 06:26:37 AM
Hi,
If you are using a ugui slider you can use the action "U Gui Slider Get Normalized Value"
If you can not find the action you should get the 'ugui proxy full' package from the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)
Title: Re: Convert float to... float
Post by: 4ppleseed on October 24, 2016, 11:58:14 AM
Just thought I'd simplify my question; I want one float that is clamped between 40-80 to control the interpolation of another float that is clamped between 0-1.

I think you want sample curve:
https://hutonggames.fogbugz.com/default.asp?W241

Title: Re: Convert float to... float
Post by: Raknill on October 24, 2016, 09:40:21 PM
Hi,
If you are using a ugui slider you can use the action "U Gui Slider Get Normalized Value"
If you can not find the action you should get the 'ugui proxy full' package from the Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)

This was exactly what I needed, very easy to implement. I had an animated element that I wanted to control in accordance with the slider (an "awareness meter" and an animated eyeball for a stealth game).

All works great now, appreciate it.