How to retrieve a value from a child particle
#2
(12-05-2019, 12:03 PM)oumoumad Wrote: I am trying to retrieve the velocity megnitude value from child particles in the wobble.
For ex in the grass example scene, the first event containing the grass changes oriantation based on the position of the child particles. There is no force applied to the parent particle, but they are applied in the second event to the child particles which allows for the spring effect.
What I'm trying to do is to get that velocity magnitude value from those child particles and use that in the mapping operator of the parent particles (the grass).


Answering myself to share a solution I just came up with.
Ended up achieving this through scripting, I noticed the IDs of the child particles come respectively after the parent particles, meaning the child for ID 1 is same as 101 if there are 100 particles in total.
So this is my working script :
Code:
for (int i = 0; i < eventParticleCount; i++)                
    {
        int sInx = tf.GetSimIndex(i); //simulation index for the event particles
        int childSInx = sInx + eventParticleCount ;  // simulation index for the child particles
        Point3 childVel = tf.GetVel(childSInx); // velocity of the child particles
        tf.SetCustomFloat(sInx, "childVel", childVel.magnitude)    ; // setting a custom float property with the velocity magnitude of the child particles
    }

Something tells me there is much simpler/intellegent ways to achieve this, so pelase let me know.
  Reply


Messages In This Thread
RE: How to retrieve a value from a child particle - by oumoumad - 12-05-2019, 03:05 PM

Forum Jump: