How to get scale vector of objects
#2
There's not a built-in way to measure scale delta, but you could easily do it in a Script operator.

Basically, just grab the magnitude of the scale vector of a particle and check if it's bigger or smaller than the previous magnitude of the particle's scale vector (if it's larger, it means the particle is growing, etc). After you're done the check, save the magnitude value to a custom properties channel so that the current value becomes the previous value in the next time step. Default custom property float values are 0, so you can check for a previous value of 0 to ensure you don't try a comparison before any previous value was saved (ie, on the first frame of your sim).

The code inside your Script for loop would be something like:

Code:
float mag = tf.GetScale(sInx).magnitude;
float prevMag = tf.GetCustomFloat(sInx, "scaleMag");
if (prevMag > mag && prevMag != 0)
{
     //particle is shrinking so spawn some sparks or whatever here
}
tf.SetCustomFloat(sInx, "scaleMag", mag);
  Reply


Messages In This Thread
How to get scale vector of objects - by Anton3000 - 12-08-2019, 05:38 PM
RE: How to get scale vector of objects - by tyFlow - 12-08-2019, 06:01 PM

Forum Jump: