Example #1
0
    /// <summary>
    /// puts line renderer points from left to right according to coordinate space and observed distribution
    /// </summary>
    public override void Visualize()
    {
        Vector3[] curvePoints = new Vector3[resolution];
        float     interval    = Width / resolution;

        for (int i = 0; i < resolution; i++)
        {
            float x = -Width / 2 + interval * i;
            float y = ObservedDistribution.Value(Center + (x / Width) * HorizontalScale) / VerticalScale * Height - Height / 2;
            curvePoints[i] = new Vector3(x, y, 0);
        }
        line.positionCount = resolution;
        line.SetPositions(curvePoints);
    }
Example #2
0
    public override void Visualize()
    {
        int particleCount = theParticleSystem.GetParticles(particles);

        for (int i = 0; i < particleCount; i++)
        {
            float x = Center + (particles[i].position.x / Width) * HorizontalScale;
            float y = ObservedDistribution.Value(x) / VerticalScale * Height - Height / 2;
            if (particles[i].position.y > y)
            {
                particles[i].remainingLifetime = 0;
            }
        }
        theParticleSystem.SetParticles(particles, particleCount);
    }