# playMaker

### Author Topic: "float filter" & "combo math"  (Read 2504 times)

#### MS80

• Junior Playmaker
• Posts: 63
##### "float filter" & "combo math"
« on: April 19, 2014, 03:18:22 PM »
Hi, I am new to Playmaker and absolutely hooked! It is easy to use and makes fun to work with...

After building up my first fsm's and logic's I assume these 2 actions could be useful:

1. float filter(or flatten, smooth):

At the moment I use "Vector3 Low Pass Filter" to filter a float value (set vector with float variable in it, filter this vector, dissolving float varialbe). It works fine, but 3 actions are needed and vectoroperation has to be calculated to smooth out a single float variable.
I found this custom action =>
http://hutonggames.com/playmakerforum/index.php?topic=2808.0
... but it is not working / show no effect at all (or I am using it in the wrong way)

2. combo math:
In many cases multiple math calculations has to be performed to get the final value...(f.e multiply 2 values, then add a 3rd value, subtract another varialbe, after that add something and at the end divide it by a factor and so on...) => with playmaker only 1 calculation (add, subtract, multiply, etc) in 1 action can be calculated, this results in a long sequence of actions doing single calculations, correct?!

So combining all these "simple" calculations in ONE combo action could be easier... Image you could define multiple variables as letters and write a little expression:

"combo math" (nr. of variable should be possible to edit)

A: variable1 (positionX)
B: varibale2 (min)
C: variable3 (max)
D: varibale4 (factor)
E: variable5 (offsetX)

((A+E)/1024)*D>B && A<=C) says 0 if false and 1 if true
there are so many possiblities...

What do you think? Maybe there exist already custom actions like this ?!?

« Last Edit: April 19, 2014, 03:20:16 PM by MS80 »

#### Kubold

• Full Member
• Posts: 100
##### Re: "float filter" & "combo math"
« Reply #1 on: April 23, 2014, 12:02:33 AM »
Good thinking, I also could really use comparing multiple values. For example, compare 4 floats or ints and get smallest and greatest result.

Actually... can you do that with ArrayMaker?
« Last Edit: April 23, 2014, 12:10:49 AM by Kubold »

#### Lane

• Hero Member
• Posts: 2488
• Yup.
##### Re: "float filter" & "combo math"
« Reply #2 on: April 23, 2014, 05:19:05 AM »
The closest we have is this:
http://hutonggames.com/playmakerforum/index.php?topic=4066.msg18991#msg18991

From what I understand the trouble is getting the customization features of the math in the action to compile at runtime. That's for allowing typed code via an action.

Otherwise, you could make a custom action for the sequence of math that you need, but then again you could also stack up Float Operators or whatever to perform the math as well.

If you need the extra customization in the math then you probably want to just make a custom action for that particular equation. It's not very hard but you might end up with a lot of small, unique actions I suppose.

You can put floats into an array, sort them, and grab the first/last for the min/max value.