public MyEditorActionVoxelHand(MyVoxelMap voxelMap, MyVoxelHandShape voxelHandShape)
     : base(voxelMap)
 {
     MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyEditorActionVoxelHand::ctor");
     m_voxelHandShape = voxelHandShape;
     m_voxelShapes = voxelMap.GetVoxelHandShapes();
     MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
 }
        public static void LoadData()
        {
            // default shape is sphere
            MyMwcObjectBuilder_VoxelHand_Sphere defaultBuilder = new MyMwcObjectBuilder_VoxelHand_Sphere(new MyMwcPositionAndOrientation(MySpectator.Orientation, Vector3.Forward, Vector3.Up), MyVoxelConstants.DEFAULT_VOXEL_HAND_SIZE, MyMwcVoxelHandModeTypeEnum.SUBTRACT);
            VoxelHandShape = new MyVoxelHandSphere();
            ((MyVoxelHandSphere)VoxelHandShape).Init(defaultBuilder, null);

            m_Enabled = false;
            m_timeFromLastShaping = 0;
            m_distance = MyVoxelConstants.DEFAULT_VOXEL_HAND_DISTANCE;
            IsProjected = false;
            IsProjectedToWaypoints = false;
        }
        public static void SetVoxelProperties(MyVoxelHandShapeType voxelHandShapeType, float distance, MyMwcVoxelHandModeTypeEnum modeType, MyMwcVoxelMaterialsEnum? materialEnum, bool isProjected, bool isProjectedToWaypoints)
        {
            IsProjected = isProjected;
            IsProjectedToWaypoints = isProjectedToWaypoints;
            // same shape type
            if (voxelHandShapeType == MyEditorVoxelHand.VoxelHandShape.GetShapeType())
            {
                //if ((size >= MyVoxelConstants.MIN_VOXEL_HAND_SIZE) && (size <= MyVoxelConstants.MAX_VOXEL_HAND_SIZE))
                {
                    //MyEditorVoxelHand.VoxelHandShape.SetShapeSize(size);
                    //MyEditorVoxelHand.VoxelHandShape.SetShapeSize2(size2);
                    //MyEditorVoxelHand.VoxelHandShape.SetShapeSize3(size3);
                    MyEditorVoxelHand.VoxelHandShape.ModeType = modeType;
                    MyEditorVoxelHand.VoxelHandShape.Material = materialEnum;
                }
            }
            // another shape type
            else 
            {
              //  float newShapeSize = size;
               // if ((newShapeSize < MyVoxelConstants.MIN_VOXEL_HAND_SIZE) && (newShapeSize > MyVoxelConstants.MAX_VOXEL_HAND_SIZE))
               
                float    newShapeSize = MyVoxelConstants.DEFAULT_VOXEL_HAND_SIZE;
                
                MyMwcPositionAndOrientation positionAndOritentation = new MyMwcPositionAndOrientation(MySpectator.Position, Vector3.Forward, Vector3.Up);
                switch (voxelHandShapeType) 
                {
                    case MyVoxelHandShapeType.Sphere:
                        MyMwcObjectBuilder_VoxelHand_Sphere sphereObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Sphere(positionAndOritentation, newShapeSize, modeType);
                        MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandSphere();
                        ((MyVoxelHandSphere)MyEditorVoxelHand.VoxelHandShape).Init(sphereObjectBuilder, null);
                        break;
                    case MyVoxelHandShapeType.Box:
                        MyMwcObjectBuilder_VoxelHand_Box boxObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Box(positionAndOritentation, newShapeSize, modeType);
                        MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandBox();
                        ((MyVoxelHandBox)MyEditorVoxelHand.VoxelHandShape).Init(boxObjectBuilder, null);
                        break;
                    case MyVoxelHandShapeType.Cuboid:
                        MyMwcObjectBuilder_VoxelHand_Cuboid cuboidObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Cuboid(positionAndOritentation, newShapeSize, newShapeSize, newShapeSize, newShapeSize, newShapeSize, modeType);
                        MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandCuboid();
                        ((MyVoxelHandCuboid)MyEditorVoxelHand.VoxelHandShape).Init(cuboidObjectBuilder, null);
                        break;
                    case MyVoxelHandShapeType.Cylinder:
                        MyMwcObjectBuilder_VoxelHand_Cylinder cylinderObjectBuilder = new MyMwcObjectBuilder_VoxelHand_Cylinder(positionAndOritentation, newShapeSize, newShapeSize, newShapeSize, modeType);
                        MyEditorVoxelHand.VoxelHandShape = new MyVoxelHandCylinder();
                        ((MyVoxelHandCylinder)MyEditorVoxelHand.VoxelHandShape).Init(cylinderObjectBuilder, null);
                        break;

                    default:
                        System.Diagnostics.Debug.Assert(false);
                        break;
                }
                MyEditorVoxelHand.VoxelHandShape.Material = materialEnum;
            }

            if (IsProjected)
            {
                if (!MyFakes.MWBUILDER)
                {
                    if ((distance >= MyVoxelConstants.MIN_PROJECTED_VOXEL_HAND_OFFSET) && (distance <= MyVoxelConstants.MAX_PROJECTED_VOXEL_HAND_OFFSET))
                        MyEditorVoxelHand.SetShapeDistance(distance);
                }
            }
            else if (IsProjectedToWaypoints)
            {
            }
            else
            {
                if ((distance >= MyVoxelConstants.MIN_VOXEL_HAND_DISTANCE) && (distance <= MyVoxelConstants.MAX_VOXEL_HAND_DISTANCE))
                    MyEditorVoxelHand.SetShapeDistance(distance);
            }

            MyEditorVoxelHand.UpdateShapePosition();
        }