super-truite 54 Posted June 24, 2013 (edited) I am making some particle effects and I need to use engine defined variables to define some parameters. Like in this example: interval = "0.001 * (damage interpolate [0,2.5,1,8])"; I am a bit confused about the functions "factor" and "interpolate" (https://community.bistudio.com/wiki/Simple_Expression). Shouldn't it be something like this instead: a factor [x,y] = a<=x: 0 a>=y: 1 x<a<y: (a-x)/(y-x) So that: a interpolate [p,q,r,s] = a<=p:r a>q:s x<a<y: [(a-p)/(q-p)]*(s-r) +r This way it actually is a linear interpolation between the 2D points (p,r) and (q,s)? I could in principle test this, but this is really painful to do since I can use this only in configs and I have to exit/launch the game after each changes... Edited June 25, 2013 by super-truite Share this post Link to post Share on other sites
DarkDruid 96 Posted June 25, 2013 Yeah, you are right. There is just typo in your explanation of interpolate. It is: a interpolate [p,q,r,s] = a<=p:r a>=q:s p<a<q: [(a-p)/(q-p)]*(s-r) +r Share this post Link to post Share on other sites
super-truite 54 Posted June 25, 2013 thank you DarkDruid. (typo corrected in the 1st post) Share this post Link to post Share on other sites