move to most far
#1
hi,
plase tell me how to move particles to most far mesh-face.
closest or neighbour is very popular, but that's option is not fit this scene.

example, the particles birth on cylinder geometry.
FindTarget(Random) make particles move to random target face on the same cylinder-geo.

but it is moving far or near randomly.
i want to move particles most far, to say in other words,  move to opposite side cylinder face .

thanks

i have tried check mesh to get most far vertex (point3) with C# script.
but I got customVector(target) that is [0,0,0,] all particles. Huh

Code:
public void simulationStep()
{    
    for (int i = 0; i < eventParticleCount; i++) //this for-loop iterates through all particles in this event                
    {
        int sInx = tf.GetSimIndex(i); //for each event particle, we fetch its simulation index

        int id = tf.GetID(i);
        int one = 1;

        tfObj o = objects[0];
        var mesh = tf.GetMesh(0);
        float mostFarLen=0.0F;
        int mostFarVt=0;
        //check in mesh
        for (int v = 0; v < mesh.GetNumFaces(); v++)
        {
            var face = mesh.GetFace(v);
            Point3 p1 =  mesh.GetVert(face.v1);
            float dist = Distance(p1, tf.GetPos(i));
            if(mostFarLen<dist){
                mostFarLen=dist;
                mostFarVt=v;
            }
            
        }
        //set vector point3 as "target" channel
        tf.SetCustomVector(0, "target", mesh.GetVert((mesh.GetFace(mostFarVt)).v1));
    }
}
  Reply
#2
You need to set the custom vector on sInx, not 0.
  Reply


Forum Jump: