Example #1
0
        // This is called to update UV dragging
        protected virtual void UpdateDragUV()
        {
            float u_ray = 1.0f;

            // Calculate intersection position
            this.Level.plane.GetIntersection(General.Map.VisualCamera.Position, General.Map.VisualCamera.Target, ref u_ray);
            Vector3D intersect = General.Map.VisualCamera.Position + (General.Map.VisualCamera.Target - General.Map.VisualCamera.Position) * u_ray;

            // Calculate offsets
            Vector3D dragdelta = intersect - dragorigin;
            float    offsetx   = dragdelta.x;
            float    offsety   = dragdelta.y;

            // Apply offsets
            int newoffsetx = startoffsetx - (int)Math.Round(offsetx);
            int newoffsety = startoffsety + (int)Math.Round(offsety);

            mode.ApplyFlatOffsetChange(prevoffsetx - newoffsetx, prevoffsety - newoffsety);
            prevoffsetx = newoffsetx;
            prevoffsety = newoffsety;

            mode.ShowTargetInfo();
        }