internal void SetWaypoint(CollisionIndex WP, CollisionPlane p)
        {
            LastPlane = p;
            if (this.button1 == null)
            {
                InitializeComponent();
            }
            Current           = WP;
            this.Text         = WP.ToString();// +" matrix=" + WP.GetMatrix((float)WP.Position.Z);
            this.button1.Text = WP.ExtraInfoString(LastPlane);
            int i = 0;

            foreach (Button B in CurrentButtons)
            {
                Controls.Remove(B);
            }

            CurrentButtons.Clear();

            foreach (IMeshedObject O in WP.GetOccupiedObjects(p.MinZ, p.MaxZ))
            {
                i++;
                Button B = new Button();
                B.Location  = new System.Drawing.Point(24, 28 + i * 20);
                B.Name      = "o" + i;
                B.Size      = new System.Drawing.Size(715, 23);
                B.TabIndex  = i;
                B.Text      = O.DebugString();
                B.TextAlign = ContentAlignment.MiddleLeft;
                B.UseVisualStyleBackColor = true;
                B.Click += new System.EventHandler(this.object_click);
                this.Controls.Add(B);
                CurrentButtons.Add(B);
            }
        }
        private void object_click(object sender, EventArgs e)
        {
            IList <CollisionObject> occs = (IList <CollisionObject>)Current.GetOccupiedObjects(LastPlane.MinZ, LastPlane.MaxZ);

            try
            {
                if (sender is Button)
                {
                    Button          B    = (Button)sender;
                    string          name = B.Name.Substring(1);
                    int             i    = int.Parse(name) - 1;
                    CollisionObject O    = occs[i];
                    if (O is IMeshedObject)
                    {
                        ((IMeshedObject)O).RemeshObject();
                    }
                }
            }
            catch (Exception ex)
            {
                CollisionPlane.Debug(ex);
            }
        }
        internal void SetWaypoint(CollisionIndex WP,CollisionPlane p)
        {
            LastPlane = p;
            if (this.button1 == null)
            {
                InitializeComponent();
            }
            Current = WP;
            this.Text = WP.ToString();// +" matrix=" + WP.GetMatrix((float)WP.Position.Z);
            this.button1.Text = WP.ExtraInfoString(LastPlane);
            int i = 0;

            foreach (Button B in CurrentButtons)
            {
                Controls.Remove(B);
            }

            CurrentButtons.Clear();

            foreach (IMeshedObject O in WP.GetOccupiedObjects(p.MinZ, p.MaxZ))
            {
                i++;
                Button B = new Button();
                B.Location = new System.Drawing.Point(24, 28+i*20);
                B.Name = "o"+i;
                B.Size = new System.Drawing.Size(715, 23);
                B.TabIndex = i;
                B.Text = O.DebugString();
                B.TextAlign = ContentAlignment.MiddleLeft;
                B.UseVisualStyleBackColor = true;
                B.Click += new System.EventHandler(this.object_click);
                this.Controls.Add(B);
                CurrentButtons.Add(B);
            }

        }