playMaker

Author Topic: Pick lowest value from couple of floats  (Read 814 times)

Kubold

  • Junior Playmaker
  • **
  • Posts: 99
    • View Profile
Pick lowest value from couple of floats
« on: May 19, 2014, 01:18:46 AM »
Hello!

What would be the easiest way to pick lowest value from couple of float variables?

For example we have 4 floats with different values. We want to always pick the lowest (every frame). Is there an Action for that or do I make a super complicated graph using "float compare" for every of 2 floats (if it's just 4 floats than no problem, but what if it's 50)?

Thanks!
Kuba

Kubold

  • Junior Playmaker
  • **
  • Posts: 99
    • View Profile
Re: Pick lowest value from couple of floats
« Reply #1 on: May 19, 2014, 01:56:37 AM »
Ok, I found this:

http://hutonggames.com/playmakerforum/index.php?topic=1599.0

Mathf.Min

"Description
Returns the smallest of two or more values."

So this action compares two values. Can it be modified so you can choose how many values you compare?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Pick lowest value from couple of floats
« Reply #2 on: May 26, 2014, 01:11:30 AM »
Hi,

 You have now two new custom actions features on the ecosystem that do excatly that. And the latest version of ArrayMaker also features this kind of functions.

 If you want to use the ecosystem browser, get it here:
https://hutonggames.fogbugz.com/default.asp?W1181

and then simply search for "min" or "max", and it will be listed there.


Else you can get the custom actions directly on the public repository:

https://github.com/jeanfabre/PlayMakerCustomActions_U3/blob/master/Assets/PlayMaker%20Custom%20Actions/Math/GetFloatsMin.cs

https://github.com/jeanfabre/PlayMakerCustomActions_U3/blob/master/Assets/PlayMaker%20Custom%20Actions/Math/GetFloatsMax.cs



 Bye,

 Jean

Kubold

  • Junior Playmaker
  • **
  • Posts: 99
    • View Profile
Re: Pick lowest value from couple of floats
« Reply #3 on: May 26, 2014, 01:45:13 AM »
Thanks! I'll check out this Ecosystem thingie, sounds awesome.