当前位置: 首页>>代码示例>>C#>>正文


C# IMyCubeGrid.GridIntegerToWorld方法代码示例

本文整理汇总了C#中IMyCubeGrid.GridIntegerToWorld方法的典型用法代码示例。如果您正苦于以下问题:C# IMyCubeGrid.GridIntegerToWorld方法的具体用法?C# IMyCubeGrid.GridIntegerToWorld怎么用?C# IMyCubeGrid.GridIntegerToWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMyCubeGrid的用法示例。


在下文中一共展示了IMyCubeGrid.GridIntegerToWorld方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: rejectionIntersects

        /// <summary>
        /// Rejection test for intersection with the profiled grid.
        /// </summary>
        /// <param name="grid">Grid whose cells will be rejected and compared to the profiled grid's rejections.</param>
        /// <returns>True iff there is a collision</returns>
        public bool rejectionIntersects(IMyCubeGrid grid, IMyCubeBlock ignore, out MyEntity entity, out Vector3? pointOfObstruction)
        {
            m_logger.debugLog(m_grid == null, "m_grid == null", Logger.severity.FATAL);

            //m_logger.debugLog("testing grid: " + grid.getBestName(), "rejectionIntersects()");

            GridCellCache gridCache = GridCellCache.GetCellCache(grid);
            MatrixD toLocal = m_grid.WorldMatrixNormalizedInv;
            Line pathLine = Path.get_Line();

            float minDist = m_grid.GridSize + grid.GridSize;
            //if (!m_landing)
            //	minDist += NotLandingBuffer;
            float pathRadius = Path.Radius + minDist;
            float minDistSquared = minDist * minDist;

            MyEntity entity_in = null;
            Vector3? pointOfObstruction_in = null;
            using (m_lock_rejcectionCells.AcquireSharedUsing())
                gridCache.ForEach(cell => {
                    Vector3 world = grid.GridIntegerToWorld(cell);
                    //m_logger.debugLog("checking position: " + world, "rejectionIntersects()");
                    if (pathLine.PointInCylinder(pathRadius, world))
                    {
                        //m_logger.debugLog("point in cylinder: " + world, "rejectionIntersects()");
                        Vector3 local = Vector3.Transform(world, toLocal);
                        if (rejectionIntersects(local, minDistSquared))
                        {
                            entity_in = grid.GetCubeBlock(cell).FatBlock as MyEntity ?? grid as MyEntity;
                            if (ignore != null && entity_in == ignore)
                                return false;

                            pointOfObstruction_in = pathLine.ClosestPoint(world);
                            return true;
                        }
                    }
                    return false;
                });

            if (pointOfObstruction_in.HasValue)
            {
                entity = entity_in;
                pointOfObstruction = pointOfObstruction_in;
                return true;
            }

            entity = null;
            pointOfObstruction = null;
            return false;
        }
开发者ID:Souper07,项目名称:Autopilot,代码行数:55,代码来源:GridShapeProfiler.cs

示例2: ToWorld

 public PositionWorld ToWorld(IMyCubeGrid grid)
 {
     return grid.GridIntegerToWorld(vector);
 }
开发者ID:Souper07,项目名称:Autopilot,代码行数:4,代码来源:Position.cs


注:本文中的IMyCubeGrid.GridIntegerToWorld方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。