playMaker

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

Kubold

  • Full Member
  • ***
  • Posts: 112
Pick lowest value from couple of floats
« on: May 19, 2014, 04: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

  • Full Member
  • ***
  • Posts: 112
Re: Pick lowest value from couple of floats
« Reply #1 on: May 19, 2014, 04: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: 15500
  • Official Playmaker Support
Re: Pick lowest value from couple of floats
« Reply #2 on: May 26, 2014, 04: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

  • Full Member
  • ***
  • Posts: 112
Re: Pick lowest value from couple of floats
« Reply #3 on: May 26, 2014, 04:45:13 AM »
Thanks! I'll check out this Ecosystem thingie, sounds awesome.