Exemplo n.º 1
0
    void TestAndDeactivate()
    {
        //does it meet requirements to be killed? ie going below y-5
        MyParticle flake;

        for (int i = 0; i < flakeList.Length; i++)
        {
            flake = flakeList[i].GetComponent <MyParticle>();
            if (flakeList[i].activeSelf)
            {
                if ((flake.GetCount() >= spline.getListLength() - 10) || flake.GetLifespan() >= 4f)
                {
                    flakeList[i].SetActive(false);
                    inactiveList[inactiveCount] = i;
                    flake.ResetLifespan();
                    Vector3 initPosition = new Vector3(heightRandList[i % maxRandLength], randList[i % maxRandLength].y, randList[(i) % maxRandLength].x);

                    //this carries the transformation about the unit circle, about 0 0 0 axis. will change in swirl
                    flake.transform.position = initPosition;
                    flake.SetInitUnitPosition(initPosition);

                    flake.SetOldPosition(flake.transform.position - flake.GetRelativeOldPosition());
                    inactiveCount++;
                }
            }
        }
    }
Exemplo n.º 2
0
    void Start()
    {
        while (counter < spline.getListLength())
        {
            P = spline.getPositionAtI(counter);
            V = spline.getVelocityAtI(counter);
            Q = spline.getAccelerationAtI(counter);
            k = (Vector3.Cross(Vector3.Cross(V, Q), V)) / Mathf.Pow(V.magnitude, 4);

            T = V / V.magnitude;
            N = k / k.magnitude;
            B = Vector3.Cross(T, N);

            Vector3[] currentFrenet = new Vector3[3];
            currentFrenet[0] = T;
            currentFrenet[1] = N;
            currentFrenet[2] = B;

            frameList.Add(currentFrenet);

            //to reset it so its always adding the next set of 3 vectors
            // currentFrenet.Clear();
            counter++;
        }
    }