Exemplo n.º 1
0
    void CurvedSwirl(MyParticle flake)
    {
        int count = flake.GetCount();

        if (count < spline.getListLength())
        {
            //transform of flake = this point
            Vector3 positionAtI = spline.getPositionAtI(count);

            Vector3[] coordinateFrame = frenet.frenetAt(count);

            Vector3 T = coordinateFrame[0];
            Vector3 N = coordinateFrame[1];
            Vector3 B = coordinateFrame[2];

            float omega = GetCurvedOmega(flake, T, N, B, positionAtI);

            //we need the position it should be at, plus rotation
            flake.transform.position = positionAtI;
            flake.transform.rotation = Quaternion.LookRotation(T, N);

            Vector3 flakeOriginalPosition = flake.getInitUnitPosition();

            flake.transform.position = positionAtI + flakeOriginalPosition;

            float   factor      = 1f;
            Vector3 oldPosition = flake.transform.position;

            flake.transform.RotateAround(positionAtI, T, omega * Time.time);

            flake.IncCount();
        }
    }