Example #1
0
    public IEnumerator adjustSphere(Vector3 center, float radius, float impact, Terrain tr, TerrainCollider tc, Rigidbody rb)
    {
        //if( hitCount == 0 ) Debug.Log( "tr hit start " + Time.frameCount );

        hitCount++;

        //Debug.Log( hitCount );

        yield return(new WaitForFixedUpdate());



        var adjuster = new FieldAdjusterForExplosionShpere(center, radius, impact, this);


        // 位置フレーム内の地形変形は、一度に修正する。
        // 地形変形の場合、detect off はあったほうがいいぽい。衝突物の多さの関係かも?

        if (!tc.enabled)
        {
            rb.detectCollisions = false; tc.enabled = false;
        }

        adjuster.adjustHeights(this);

        if (--hitCount <= 0)
        {
            tc.enabled = true; rb.detectCollisions = true;
        }

        //if( hitCount <= 0 ) Debug.Log( "tr hit end " + Time.frameCount );


        yield return(0);       // new WaitForFixedUpdate();



        adjuster.adjustAlphamaps(this);



        yield return(0);       // new WaitForFixedUpdate();



        adjuster.adjustDetails(this);

        tr.Flush();
    }
Example #2
0
    public IEnumerator adjustSphere(Vector3 center, float radius, float impact, Terrain tr, TerrainCollider tc /*, Rigidbody rb*/)
    {
        var adjuster = new FieldAdjusterForExplosionShpere(center, radius, impact, this);


        tc.enabled = false;

        adjuster.adjustHeights(this);

        tc.enabled = true;

        yield return(0);

        adjuster.adjustAlphamaps(this);
    }