Insert() public method

public Insert ( RecastMeshObj mesh ) : void
mesh RecastMeshObj
return void
示例#1
0
 private void Register()
 {
     if (!this.registered)
     {
         this.registered = true;
         this.area       = Mathf.Clamp(this.area, -1, 0x2000000);
         Renderer component = base.GetComponent <Renderer>();
         Collider collider  = base.GetComponent <Collider>();
         if ((component == null) && (collider == null))
         {
             throw new Exception("A renderer or a collider should be attached to the GameObject");
         }
         MeshFilter filter = base.GetComponent <MeshFilter>();
         if ((component != null) && (filter == null))
         {
             throw new Exception("A renderer was attached but no mesh filter");
         }
         this.bounds   = (component == null) ? collider.bounds : component.bounds;
         this._dynamic = this.dynamic;
         if (this._dynamic)
         {
             dynamicMeshObjs.Add(this);
         }
         else
         {
             tree.Insert(this);
         }
     }
 }
示例#2
0
        void Register()
        {
            if (registered)
            {
                return;
            }

            registered = true;

            //Clamp area, upper limit isn't really a hard limit, but if it gets much higher it will start to interfere with other stuff
            area = Mathf.Clamp(area, -1, 1 << 25);

            Renderer rend = renderer;

            Collider coll = collider;

            if (rend == null && coll == null)
            {
                throw new System.Exception("A renderer or a collider should be attached to the GameObject");
            }

            MeshFilter filter = GetComponent <MeshFilter>();

            if (rend != null && filter == null)
            {
                throw new System.Exception("A renderer was attached but no mesh filter");
            }

            //Default to renderer
            if (rend != null)
            {
                bounds = rend.bounds;
            }
            else
            {
                bounds = coll.bounds;
            }

            _dynamic = dynamic;
            if (_dynamic)
            {
                dynamicMeshObjs.Add(this);
            }
            else
            {
                tree.Insert(this);
            }
        }