Ejemplo n.º 1
0
        public static SimWaypoint CreateLocal(Vector3 from, CollisionPlane CP)
        {
            SimPathStore   PathStore        = CP.PathStore;
            float          POINTS_PER_METER = PathStore.POINTS_PER_METER;
            int            PX = PathStore.ARRAY_X(from.X);
            int            PY = PathStore.ARRAY_Y(from.Y);
            SimWaypoint    WP;
            CollisionIndex CI = CollisionIndex.CreateCollisionIndex(from, PathStore);

            lock (CI)
            {
                WP = CI.FindWayPoint(from.Z);
                if (WP != null)
                {
                    return(WP);
                }
                from.X = PX / POINTS_PER_METER;
                from.Y = PY / POINTS_PER_METER;
                Vector3d GlobalPos = PathStore.LocalToGlobal(from);
                if (GlobalPos.X < 256 || GlobalPos.Y < 256)
                {
                    CollisionPlane.Debug("bad global " + GlobalPos);
                }
                WP            = new SimWaypointImpl(from, GlobalPos, CI, CP, PathStore);
                WP.IsPassable = true;
            }
            // wp._IncomingArcs = new ArrayList();
            // wp._OutgoingArcs = new ArrayList();
            //  PathStore.EnsureKnown(wp);
            return(WP);
        }
Ejemplo n.º 2
0
        public void SetGlobalPos(Vector3d v3d)
        {
            SimPathStore R = SimPathStore.GetPathStore(v3d);

            _LocalPos  = SimPathStore.GlobalToLocal(v3d);
            PathStore  = R.GetPathStore3D(_LocalPos);
            _GlobalPos = R.LocalToGlobal(_LocalPos);
            //PX = (int)Math.Round(_LocalPos.X * PathStore.POINTS_PER_METER);
            //PY = (int)Math.Round(_LocalPos.Y * PathStore.POINTS_PER_METER);
            if (_IncomingArcs != null)
            {
                foreach (SimRoute A in _IncomingArcs)
                {
                    A.LengthUpdated = false;
                }
            }
            if (_OutgoingArcs != null)
            {
                foreach (SimRoute A in _OutgoingArcs)
                {
                    A.LengthUpdated = false;
                }
            }
        }