コード例 #1
0
ファイル: ChiBallBreath.cs プロジェクト: leweyg/vrbiofield
 void UpdateParticles_GeneralChi(ParticleSpan ps, float toffset)
 {
     for (int i = 0; i < ps.Count; i++)
     {
         float ba      = this.Breath.UnitBreathInPct;
         float fi      = ((float)i) / ((float)(ps.Count - 1));
         float mt      = Mathf.Repeat(fi + toffset, 1.0f);
         float a       = ba * Mathf.Clamp01(Breath.UnitTo010f(mt) * 5.1f);
         var   pos     = ps.Line.SampleAtUnitLength(mt);
         bool  isSpine = false;
         var   clr     = Color.green;
         if (this.IsInfoAvatar)
         {
             if (ps == this.ClosestInfoSpan)
             {
                 // leave alpha as is
             }
             else
             {
                 a = 0.0f;
             }
         }
         ps.LatestOverallAlpha = a;
         var pi = ps.IndexOf(i);
         this.Particles [pi].position   = pos;
         this.Particles [pi].startColor = ColorWithAlpha(clr, a);
     }
 }
コード例 #2
0
    void UpdateInfoModel()
    {
        var          ray       = FocusRay.main.CurrentRay;
        float        bestScore = 0.7f;
        ParticleSpan bestSpan  = null;

        foreach (var ps in this.AllSpans)
        {
            float score = Vector3.Dot((ps.Line.AveragePoint - ray.origin).normalized, ray.direction.normalized);
            if (score > bestScore)
            {
                bestSpan  = ps;
                bestScore = score;
            }
        }
        this.ClosestInfoSpan = bestSpan;
    }
コード例 #3
0
ファイル: ChiBallBreath.cs プロジェクト: leweyg/vrbiofield
    protected override void VirtualSetupCoreLine()
    {
        this.ApplyBodyPositioning();
        //this.ParticleCountBase = 4;

        this.SphereRadius = Vector3.Distance(this.Body.EstLeftHandKnuckle.position, this.Body.EstRightHandKnuckle.position) * 0.4f;
        {
            var dantien = this.Body.Chakras.AllChakras [1].transform.position;
            var pnts    = new Vector3[] { (this.Body.EstLeftHandKnuckle.position + this.Body.EstRightHandKnuckle.position) * 0.5f, dantien };
            this.HandToHandSpan = new ParticleSpan(this, this.ParticleCountBase, new LinesThroughPoints(pnts));
        }
        {
            var pnts = this.LineBetweenTransforms(this.Body.LeftArmStart, this.Body.EstLeftHandKnuckle);
            this.LeftSideSpan = new ParticleSpan(this, this.ParticleCountBase, new LinesThroughPoints(pnts.ToArray()));
        }
        {
            var pnts = this.LineBetweenTransforms(this.Body.RightArmStart, this.Body.EstRightHandKnuckle);
            this.RightSideSpan = new ParticleSpan(this, this.ParticleCountBase, new LinesThroughPoints(pnts.ToArray()));
        }
    }
コード例 #4
0
ファイル: ChiBallBreath.cs プロジェクト: leweyg/vrbiofield
    void UpdateParticles_HandToHandSpan(ParticleSpan ps, float toffset)
    {
        var offsets = ps.EnsureRandomOffsets();

        for (int i = 0; i < ps.Count; i++)
        {
            float bt = this.Breath.UnitTimeInBreath;
            float ba = this.Breath.UnitBreathInPct;
            float fi = ((float)i) / ((float)(ps.Count - 1));
            float mt = Mathf.Repeat(fi + toffset, 1.0f);
            float a  = ba * Mathf.Clamp01(Breath.UnitTo010f(mt) * 5.1f);


            var basePose = ps.Line.SampleAtLength(Mathf.Clamp01((bt - 0.5f) * 2.0f));
            var pos      = basePose + (offsets[i] * SphereRadius
                                       * Breath.UnitTo010f(bt)
                                       * Mathf.Sin(Time.timeSinceLevelLoad * 4.2f + (offsets[i].y * 20)));
            bool isSpine = false;
            var  clr     = Color.green;
            if (this.IsInfoAvatar)
            {
                if (ps == this.ClosestInfoSpan)
                {
                    // leave alpha as is
                }
                else
                {
                    a = 0.0f;
                }
            }
            ps.LatestOverallAlpha = a;

            var pi = ps.IndexOf(i);
            this.Particles [pi].position    = pos;
            this.Particles [pi].startColor  = ColorWithAlpha(clr, a);
            this.Particles [pi].startSize3D = Vector3.one * (DefaultRadius * 2.0f);
        }
    }
コード例 #5
0
    void SetupCoreLine()
    {
        switch (this.LineToShow)
        {
        case NamedLines.SpinalBreathing:
        {
            var pnts = this.LineBetweenTransforms(this.Body.SpineStart, this.Body.SpineEnd);
            this.CoreSpan = new ParticleSpan(this, 1, new LinesThroughPoints(pnts.ToArray()));
        }
        break;

        case NamedLines.GroundingBreath:
        {
            {
                var pnts = this.LineBetweenTransforms(this.Body.LeftLegEnd, this.Body.LeftLegStart);
                pnts.Add(this.Body.Chakras.AllChakras[1].transform.position);
                this.SpanLeftLegToDanTien = new ParticleSpan(this, this.ParticleCountBase, new LinesThroughPoints(pnts.ToArray()));
            }
            {
                var pnts = this.LineBetweenTransforms(this.Body.RightLegEnd, this.Body.RightLegStart);
                pnts.Add(this.Body.Chakras.AllChakras[1].transform.position);
                this.SpanRightLegToDanTien = new ParticleSpan(this, this.ParticleCountBase, new LinesThroughPoints(pnts.ToArray()));
            }
            {
                //SpanCrownToDanTien
                var pnts = this.LineBetweenTransforms(
                    this.Body.Chakras.AllChakras[6].transform,
                    this.Body.Chakras.AllChakras[1].transform);
                this.SpanCrownToDanTien = new ParticleSpan(this, (int)(0.75f * this.ParticleCountBase), new LinesThroughPoints(pnts.ToArray()));
            }
        }
        break;

        default:
            Debug.Assert(false, "Unknown line: " + this.LineToShow);
            break;
        }
    }