PDA

View Full Version : z = above(x,y)


ShadowHarlequin
15th March 2010, 18:20
how do you use the above function in the per frame code? i cant remember, im wanting to set a value (q22) to the new treb_att value if its higher than the previous one

Nitorami
15th March 2010, 18:57
As explained before, the q variables are not remembered over frames and you cannot use q22 to store a value and remember it to the next frame.

If you just want to get the long term peak value of treb_att, use

treb_max = if (above(treb_att,treb_max),treb_att,treb_max);
q22 = treb_max;

Nitorami
15th March 2010, 19:00
Alternatively, this would be some kind of derivative:

q22 = if(above(treb_att, treb_old), treb_att, 0);
treb_old = treb_att;

q22 would take the value of treb_att if treb_att is higher than in the previous frame, and 0 otherwise.