protected void CreateBoundingBox() { this.boxParentNode = Node.CreateChildSceneNode("scbno" + this.name, new Mogre.Vector3(0, 0, 0), Mogre.Quaternion.IDENTITY); this.oBBoxData = GetAABB(); this.bBoxNode = this.boxParentNode.CreateChildSceneNode("scbnb" + this.name, new Mogre.Vector3(0, 0, 0), Mogre.Quaternion.IDENTITY); this.oBBoxRenderable = new Mogre.OBBoxRenderable("SelectionBBMaterial", MogitorsRoot.Instance.ProjectOptions.SelectionBBColour); this.oBBoxRenderable.SetupVertices(this.oBBoxData); this.bBoxNode.AttachObject(this.oBBoxRenderable); this.bBoxNode.SetVisible(false); this.highlightNode = this.boxParentNode.CreateChildSceneNode("scbnhl" + this.name, new Mogre.Vector3(0, 0, 0), Mogre.Quaternion.IDENTITY); this.highlightNode.SetScale(1.05f, 1.05f, 1.05f); this.highlightRenderable = new Mogre.OBBoxRenderable("HighlightBBMaterial", MogitorsRoot.Instance.ProjectOptions.HighlightBBColour); this.highlightRenderable.SetupVertices(this.oBBoxData); this.highlightNode.AttachObject(this.highlightRenderable); this.highlightNode.SetVisible(false); }
public void DestroyBoundingBox() { if (this.oBBoxRenderable == null) return; this.oBBoxRenderable.ParentSceneNode.DetachObject(this.oBBoxRenderable); this.oBBoxRenderable = null; this.highlightRenderable.ParentSceneNode.DetachObject(this.highlightRenderable); this.highlightRenderable = null; this.boxParentNode.RemoveAndDestroyChild(this.bBoxNode.Name); this.boxParentNode.RemoveAndDestroyChild(this.highlightNode.Name); this.bBoxNode = null; this.highlightNode = null; this.boxParentNode.ParentSceneNode.RemoveAndDestroyChild(this.boxParentNode.Name); this.boxParentNode = null; }