GetBounds() public method

public GetBounds ( ) : Bounds
return UnityEngine.Bounds
Ejemplo n.º 1
0
		/** Removes the specified mesh from the tree.
		 * Assumes that it has the correct bounds information.
		 *
		 * \returns True if the mesh was removed from the tree, false otherwise.
		 */
		public bool Remove (RecastMeshObj mesh) {
			if (mesh == null) throw new ArgumentNullException("mesh");

			if (root == null) {
				return false;
			}

			bool found = false;
			Bounds b = mesh.GetBounds();
			//Convert to top down rect
			Rect r = Rect.MinMaxRect(b.min.x, b.min.z, b.max.x, b.max.z);

			root = RemoveBox(root, mesh, r, ref found);

			return found;
		}
Ejemplo n.º 2
0
        public bool Remove(RecastMeshObj mesh)
        {
            if (mesh == null)
            {
                throw new ArgumentNullException("mesh");
            }
            if (this.root == null)
            {
                return(false);
            }
            bool   result  = false;
            Bounds bounds  = mesh.GetBounds();
            Rect   bounds2 = Rect.MinMaxRect(bounds.min.x, bounds.min.z, bounds.max.x, bounds.max.z);

            this.root = this.RemoveBox(this.root, mesh, bounds2, ref result);
            return(result);
        }
Ejemplo n.º 3
0
        /*public void SearchBoxCircle (BBTreeBox box, Vector3 p, float radius, NNConstraint constraint, ref NNInfo nnInfo) {//, int intendentLevel = 0) {
         *
         *      if (box.node != null) {
         *              //Leaf node
         *              if (NodeIntersectsCircle (box.node,p,radius)) {
         *                      //Update the NNInfo
         *
         #if ASTARDEBUG
         *                      Debug.DrawLine ((Vector3)box.node.GetVertex(0),(Vector3)box.node.GetVertex(1),Color.red);
         *                      Debug.DrawLine ((Vector3)box.node.GetVertex(1),(Vector3)box.node.GetVertex(2),Color.red);
         *                      Debug.DrawLine ((Vector3)box.node.GetVertex(2),(Vector3)box.node.GetVertex(0),Color.red);
         #endif
         *
         *                      Vector3 closest = box.node.ClosestPointOnNode (p);//NavMeshGraph.ClosestPointOnNode (box.node,graph.vertices,p);
         *                      float dist = (closest-p).sqrMagnitude;
         *
         *                      if (nnInfo.node == null) {
         *                              nnInfo.node = box.node;
         *                              nnInfo.clampedPosition = closest;
         *                      } else if (dist < (nnInfo.clampedPosition - p).sqrMagnitude) {
         *                              nnInfo.node = box.node;
         *                              nnInfo.clampedPosition = closest;
         *                      }
         *                      if (constraint.Suitable (box.node)) {
         *                              if (nnInfo.constrainedNode == null) {
         *                                      nnInfo.constrainedNode = box.node;
         *                                      nnInfo.constClampedPosition = closest;
         *                              } else if (dist < (nnInfo.constClampedPosition - p).sqrMagnitude) {
         *                                      nnInfo.constrainedNode = box.node;
         *                                      nnInfo.constClampedPosition = closest;
         *                              }
         *                      }
         *              } else {
         #if ASTARDEBUG
         *                      Debug.DrawLine ((Vector3)box.node.GetVertex(0),(Vector3)box.node.GetVertex(1),Color.blue);
         *                      Debug.DrawLine ((Vector3)box.node.GetVertex(1),(Vector3)box.node.GetVertex(2),Color.blue);
         *                      Debug.DrawLine ((Vector3)box.node.GetVertex(2),(Vector3)box.node.GetVertex(0),Color.blue);
         #endif
         *              }
         *              return;
         *      }
         *
         #if ASTARDEBUG
         *      Debug.DrawLine (new Vector3 (box.rect.xMin,0,box.rect.yMin),new Vector3 (box.rect.xMax,0,box.rect.yMin),Color.white);
         *      Debug.DrawLine (new Vector3 (box.rect.xMin,0,box.rect.yMax),new Vector3 (box.rect.xMax,0,box.rect.yMax),Color.white);
         *      Debug.DrawLine (new Vector3 (box.rect.xMin,0,box.rect.yMin),new Vector3 (box.rect.xMin,0,box.rect.yMax),Color.white);
         *      Debug.DrawLine (new Vector3 (box.rect.xMax,0,box.rect.yMin),new Vector3 (box.rect.xMax,0,box.rect.yMax),Color.white);
         #endif
         *
         *      //Search children
         *      if (RectIntersectsCircle (box.c1.rect,p,radius)) {
         *              SearchBoxCircle (box.c1,p, radius, ref nnInfo);
         *      }
         *
         *      if (RectIntersectsCircle (box.c2.rect,p,radius)) {
         *              SearchBoxCircle (box.c2,p, radius, ref nnInfo);
         *      }
         * }*/

        /*public void SearchBox (BBTreeBox box, Vector3 p, NNConstraint constraint, ref NNInfo nnInfo) {//, int intendentLevel = 0) {
         *
         *      if (box.node != null) {
         *              //Leaf node
         *              if (box.node.ContainsPoint ((Int3)p)) {
         *                      //Update the NNInfo
         *
         *                      if (nnInfo.node == null) {
         *                              nnInfo.node = box.node;
         *                      } else if (Mathf.Abs(((Vector3)box.node.Position).y - p.y) < Mathf.Abs (((Vector3)nnInfo.node.Position).y - p.y)) {
         *                              nnInfo.node = box.node;
         *                      }
         *                      if (constraint.Suitable (box.node)) {
         *                              if (nnInfo.constrainedNode == null) {
         *                                      nnInfo.constrainedNode = box.node;
         *                              } else if (Mathf.Abs(box.node.Position.y - p.y) < Mathf.Abs (nnInfo.constrainedNode.Position.y - p.y)) {
         *                                      nnInfo.constrainedNode = box.node;
         *                              }
         *                      }
         *              }
         *              return;
         *      }
         *
         *      //Search children
         *      if (RectContains (box.c1.rect,p)) {
         *              SearchBox (box.c1,p, constraint, ref nnInfo);
         *      }
         *
         *      if (RectContains (box.c2.rect,p)) {
         *              SearchBox (box.c2,p, constraint, ref nnInfo);
         *      }
         * }*/

        /** Removes the specified mesh from the tree.
         * Assumes that it has the correct bounds information.
         *
         * \returns True if the mesh was removed from the tree, false otherwise.
         */
        public bool Remove(RecastMeshObj mesh)
        {
            if (mesh == null)
            {
                throw new System.ArgumentNullException("mesh");
            }

            if (root == null)
            {
                return(false);
            }

            bool   found = false;
            Bounds b     = mesh.GetBounds();
            //Convert to top down rect
            Rect r = Rect.MinMaxRect(b.min.x, b.min.z, b.max.x, b.max.z);

            root = RemoveBox(root, mesh, r, ref found);

            return(found);
        }