コード例 #1
0
        public MyNavmeshManager(MyRDPathfinding rdPathfinding, Vector3D center, Vector3D forwardDirection, int tileSize, int tileHeight, int tileLineCount, MyRecastOptions recastOptions)
        {
            Vector3 vector = new Vector3(ran.NextFloat(), ran.NextFloat(), ran.NextFloat());

            vector              -= Math.Min(vector.X, Math.Min(vector.Y, vector.Z));
            vector              /= Math.Max(vector.X, Math.Max(vector.Y, vector.Z));
            this.m_debugColor    = new Color(vector);
            this.m_tileSize      = tileSize;
            this.m_tileHeight    = tileHeight;
            this.m_tileLineCount = tileLineCount;
            this.Planet          = this.GetPlanet(center);
            this.m_heightCoordTransformationIncrease = 0.5f;
            float cellSize = 0.2f;

            this.m_recastOptions = recastOptions;
            float num2 = (this.m_tileSize * 0.5f) + (this.m_tileSize * ((float)Math.Floor((double)(this.m_tileLineCount * 0.5f))));
            float num3 = this.m_tileHeight * 0.5f;

            this.m_border = this.m_recastOptions.agentRadius + (3f * cellSize);
            float[] bMin = new float[] { -num2, -num3, -num2 };
            float[] bMax = new float[] { num2, num3, num2 };
            this.m_rdWrapper = new MyRDWrapper();
            this.m_rdWrapper.Init(cellSize, (float)this.m_tileSize, bMin, bMax);
            Vector3D vectord = Vector3D.CalculatePerpendicularVector(-Vector3D.Normalize(MyGravityProviderSystem.CalculateTotalGravityInPoint(center)));

            this.m_navmeshOBBs   = new MyNavmeshOBBs(this.Planet, center, vectord, this.m_tileLineCount, this.m_tileSize, this.m_tileHeight);
            this.m_debugTileSize = new int?[this.m_tileLineCount][];
            for (int i = 0; i < this.m_tileLineCount; i++)
            {
                this.m_debugTileSize[i] = new int?[this.m_tileLineCount];
            }
            this.m_extendedBaseOBB = new MyOrientedBoundingBoxD(this.m_navmeshOBBs.BaseOBB.Center, new Vector3D(this.m_navmeshOBBs.BaseOBB.HalfExtent.X, (double)this.m_tileHeight, this.m_navmeshOBBs.BaseOBB.HalfExtent.Z), this.m_navmeshOBBs.BaseOBB.Orientation);
            this.m_navInputMesh    = new MyNavigationInputMesh(rdPathfinding, this.Planet, center);
        }
コード例 #2
0
 public MyRDPath(MyRDPathfinding pathfinding, Vector3D begin, IMyDestinationShape destination)
 {
     this.m_pathfinding       = pathfinding;
     this.m_destination       = destination;
     this.m_isValid           = true;
     this.m_currentPointIndex = 0;
     this.m_planet            = this.GetClosestPlanet(begin);
 }
コード例 #3
0
        public MyNavigationInputMesh(MyRDPathfinding rdPathfinding, MyPlanet planet, Vector3D center)
        {
            this.m_rdPathfinding = rdPathfinding;
            this.m_planet        = planet;
            this.m_center        = center;
            Vector3 v       = (Vector3) - Vector3D.Normalize(MyGravityProviderSystem.CalculateTotalGravityInPoint(this.m_center));
            Vector3 forward = Vector3.CalculatePerpendicularVector(v);

            this.rdWorldQuaternion = Quaternion.Inverse(Quaternion.CreateFromForwardUp(forward, v));
        }
コード例 #4
0
ファイル: MyRDPath.cs プロジェクト: Pharap/GetOreMarkersInPB
        public MyRDPath(MyRDPathfinding pathfinding, Vector3D begin, IMyDestinationShape destination)
        {
            m_pathPoints = new List <Vector3D>();

            m_pathfinding       = pathfinding;
            m_destination       = destination;
            m_isValid           = true;
            m_currentPointIndex = 0;

            m_planet = GetClosestPlanet(begin);
        }
コード例 #5
0
        public MyNavigationInputMesh(MyRDPathfinding rdPathfinding, MyPlanet planet, Vector3D center)
        {
            m_rdPathfinding = rdPathfinding;
            m_planet        = planet;
            m_center        = center;

            Vector3D gravityVector = -Vector3D.Normalize(GameSystems.MyGravityProviderSystem.CalculateTotalGravityInPoint(m_center));
            Vector3D fwd           = Vector3D.CalculatePerpendicularVector(gravityVector);

            rdWorldQuaternion = Quaternion.Inverse(Quaternion.CreateFromForwardUp(fwd, gravityVector));
        }
コード例 #6
0
ファイル: MyRDPath.cs プロジェクト: 2asoft/SpaceEngineers
        public MyRDPath(MyRDPathfinding pathfinding, Vector3D begin, IMyDestinationShape destination)
        {
            m_pathPoints = new List<Vector3D>();

            m_pathfinding = pathfinding;
            m_destination = destination;
            m_isValid = true;
            m_currentPointIndex = 0;

            m_planet = GetClosestPlanet(begin);
        }
コード例 #7
0
        public MyNavmeshManager(MyRDPathfinding rdPathfinding, Vector3D center, Vector3D forwardDirection, int tileSize, int tileHeight, int tileLineCount, MyRecastOptions recastOptions)
        {
            m_tileSize      = tileSize;
            m_tileHeight    = tileHeight;
            m_tileLineCount = tileLineCount;
            Planet          = GetPlanet(center);

            m_heightCoordTransformationIncrease = 0.5f;

            float cellSize = RECAST_CELL_SIZE;

            m_recastOptions = recastOptions;

            float horizontalOrigin = (m_tileSize * 0.5f + m_tileSize * (float)Math.Floor(m_tileLineCount * 0.5f));
            var   verticalOrigin   = m_tileHeight * 0.5f;

            m_border = m_recastOptions.agentRadius + 3 * cellSize;

            float[] bmin = new float[3] {
                -horizontalOrigin, -verticalOrigin, -horizontalOrigin
            };
            float[] bmax = new float[3] {
                horizontalOrigin, verticalOrigin, horizontalOrigin
            };

            m_rdWrapper = new MyRDWrapper();
            m_rdWrapper.Init(cellSize, m_tileSize, bmin, bmax);

            Vector3D gravityVector = -Vector3D.Normalize(GameSystems.MyGravityProviderSystem.CalculateTotalGravityInPoint(center));
            var      direction     = Vector3D.CalculatePerpendicularVector(gravityVector);

            m_navmeshOBBs   = new MyNavmeshOBBs(Planet, center, direction, m_tileLineCount, m_tileSize, m_tileHeight);
            m_debugTileSize = new int?[m_tileLineCount][];
            for (int i = 0; i < m_tileLineCount; i++)
            {
                m_debugTileSize[i] = new int?[m_tileLineCount];
            }

            m_extendedBaseOBB = new MyOrientedBoundingBoxD(m_navmeshOBBs.BaseOBB.Center,
                                                           new Vector3D(m_navmeshOBBs.BaseOBB.HalfExtent.X, m_tileHeight, m_navmeshOBBs.BaseOBB.HalfExtent.Z),
                                                           m_navmeshOBBs.BaseOBB.Orientation);

            m_navInputMesh = new MyNavigationInputMesh(rdPathfinding, Planet, center);
        }
コード例 #8
0
        public MyNavigationInputMesh(MyRDPathfinding rdPathfinding, MyPlanet planet, Vector3D center)
        {
            m_rdPathfinding = rdPathfinding;
            m_planet = planet;
            m_center = center;

            Vector3D gravityVector = -Vector3D.Normalize(GameSystems.MyGravityProviderSystem.CalculateTotalGravityInPoint(m_center));
            Vector3D fwd = Vector3D.CalculatePerpendicularVector(gravityVector);
            rdWorldQuaternion = Quaternion.Inverse(Quaternion.CreateFromForwardUp(fwd, gravityVector));
        }
コード例 #9
0
        void VoxelMapRangeChanged(MyVoxelBase storage, Vector3I minVoxelChanged, Vector3I maxVoxelChanged, VRage.Voxels.MyStorageDataTypeFlags changedData)
        {
            var aabb = MyRDPathfinding.GetVoxelAreaAABB(storage, minVoxelChanged, maxVoxelChanged);

            InvalidateArea(aabb);
        }
コード例 #10
0
        private void VoxelMapRangeChanged(MyVoxelBase storage, Vector3I minVoxelChanged, Vector3I maxVoxelChanged, MyStorageDataTypeFlags changedData)
        {
            BoundingBoxD areaAABB = MyRDPathfinding.GetVoxelAreaAABB(storage, minVoxelChanged, maxVoxelChanged);

            this.InvalidateArea(areaAABB);
        }