示例#1
0
        public void CalculateRotationHints(MyBlockBuilderRotationHints hints, bool isRotating)
        {
            MyCubeGrid grid = PreviewGrids.Count > 0 ? PreviewGrids[0] : null;

            if (grid != null)
            {
                Vector3I gridSize = grid.Max - grid.Min + new Vector3I(1, 1, 1);
                BoundingBoxD worldBox = new BoundingBoxD(-gridSize * grid.GridSize * 0.5f, gridSize * grid.GridSize * 0.5f);

                MatrixD mat = grid.WorldMatrix;
                Vector3D positionToDragPointGlobal = Vector3D.TransformNormal(-m_dragPointToPositionLocal, mat);
                mat.Translation = mat.Translation + positionToDragPointGlobal;

                hints.CalculateRotationHints(mat, worldBox, !MyHud.MinimalHud && MySandboxGame.Config.RotationHints, isRotating, OneAxisRotationMode);
            }
        }
        public void CalculateRotationHints(MyBlockBuilderRotationHints hints, bool isRotating)
        {
            MyEntity entity = PreviewFloatingObjects.Count > 0 ? PreviewFloatingObjects[0] : null;
            if (entity != null)
            {
                MyCubeGrid grid = entity as MyCubeGrid;
                if (grid != null && (!grid.IsStatic || EnableStationRotation))
                {
                    Vector3I gridSize = grid.Max - grid.Min + new Vector3I(1, 1, 1);
                    BoundingBoxD worldBox = new BoundingBoxD(-gridSize * grid.GridSize * 0.5f, gridSize * grid.GridSize * 0.5f);

                    MatrixD mat = entity.WorldMatrix;
                    Vector3 positionToDragPointGlobal = Vector3.TransformNormal(-m_dragPointToPositionLocal, mat);
                    mat.Translation = mat.Translation + positionToDragPointGlobal;

                    hints.CalculateRotationHints(mat, worldBox, !MyHud.MinimalHud && MySandboxGame.Config.RotationHints && MyFakes.ENABLE_ROTATION_HINTS, isRotating);
                }
            }
        }