Esempio n. 1
0
        public bool IntersectSegment(ref VInt3 segSrc, ref VInt3 segVec, ref VInt3 nearPoint, ref VInt3 pointProj)
        {
            if (this._vertecesXZ == null || this._vertecesXZ.Length < 2)
            {
                return(false);
            }
            if (!this.IsInBoundXZ(segSrc) && !this.IsInBoundXZ(segSrc + segVec))
            {
                return(false);
            }
            VInt2 xz  = segSrc.get_xz();
            VInt2 xz2 = segVec.get_xz();
            VInt2 vInt;
            VInt2 vInt2;

            if (IntMath.SegIntersectPlg(ref xz, ref xz2, this._vertecesXZ, ref vInt, ref vInt2))
            {
                nearPoint.x = vInt.x;
                nearPoint.z = vInt.y;
                pointProj.x = vInt2.x;
                pointProj.z = vInt2.y;
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        public bool IsPointIn(ref VInt3 pnt)
        {
            if (this._vertecesXZ == null || !this.IsInBoundXZ(pnt))
            {
                return(false);
            }
            VInt2 xz = pnt.get_xz();

            return(IntMath.PointInPolygon(ref xz, this._vertecesXZ));
        }
        public uint SearchNearestTarget(ref PoolObjHandle <ActorRoot> _actorPtr, VInt3 _position, int _srchR)
        {
            this.Clear();
            this.curActorPtr    = _actorPtr;
            this.searchRadius   = _srchR;
            this.searchPosition = _position;
            this.NearestHandler = new SceneManagement.Process(this.FilterNearestActorByPosition);
            SceneManagement instance = Singleton <SceneManagement> .GetInstance();

            SceneManagement.Coordinate coord = default(SceneManagement.Coordinate);
            instance.GetCoord_Center(ref coord, _position.get_xz(), _srchR);
            instance.UpdateDirtyNodes();
            instance.ForeachActors(coord, this.NearestHandler);
            return(this.GetSearchPriorityTarget(true));
        }
Esempio n. 4
0
 private void Start()
 {
     GeoVertex[] componentsInChildren = base.gameObject.GetComponentsInChildren <GeoVertex>(true);
     this._vertecesXZ = new VInt2[componentsInChildren.Length];
     for (int i = 0; i < componentsInChildren.Length; i++)
     {
         VInt3 vInt = (VInt3)componentsInChildren[i].transform.position;
         this._vertecesXZ[i] = vInt.get_xz();
         if (i == 0)
         {
             this._boundMin = vInt;
             this._boundMax = vInt;
         }
         else
         {
             if (vInt.x < this._boundMin.x)
             {
                 this._boundMin.x = vInt.x;
             }
             if (vInt.y < this._boundMin.y)
             {
                 this._boundMin.y = vInt.y;
             }
             if (vInt.z < this._boundMin.z)
             {
                 this._boundMin.z = vInt.z;
             }
             if (vInt.x > this._boundMax.x)
             {
                 this._boundMax.x = vInt.x;
             }
             if (vInt.y > this._boundMax.y)
             {
                 this._boundMax.y = vInt.y;
             }
             if (vInt.z > this._boundMax.z)
             {
                 this._boundMax.z = vInt.z;
             }
         }
     }
 }