public void SetBounds(Mogre.AxisAlignedBox box, float radius) { if (box == null) { throw new ArgumentNullException("box cannot be null!"); } IntPtr boxPtr = Marshal.AllocHGlobal(Marshal.SizeOf(box)); Marshal.StructureToPtr(box, boxPtr, true); SphereSet_SetBounds(nativePtr, boxPtr, radius); }
/// <summary> /// Fill the AxisAlignedBox with data derived from the other arguments. /// </summary> /// <param name="box"></param> /// <param name="position"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="depth"></param> public void PopulateAlignedBox(Mogre.AxisAlignedBox box, Mogre.Vector3 position, float width, float height, float depth) { if (box == null) { throw new ArgumentNullException("box cannot be null!"); } if (position == null) { throw new ArgumentNullException("position cannot be null!"); } IntPtr boxPtr = Marshal.AllocHGlobal(Marshal.SizeOf(box)); Marshal.StructureToPtr(box, boxPtr, true); BaseCollider_PopulateAlignedBox(nativePtr, boxPtr, position, width, height, depth); }
/** Overridden from MovableObject * @see * MovableObject */ public Mogre.AxisAlignedBox GetBoundingBox() { try { IntPtr scalePtr = Attachable_GetBoundingBox(nativePtr); if (scalePtr == null || scalePtr == IntPtr.Zero) { return(null); } Mogre.AxisAlignedBox aabtype = new Mogre.AxisAlignedBox(); Mogre.AxisAlignedBox vec = (Mogre.AxisAlignedBox)(Marshal.PtrToStructure(scalePtr, aabtype.GetType())); return(vec); } catch (Exception) { //if (printDebug) Console.WriteLine(e.Message + "@" + e.Source); //lastError = e; } return(null); }
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); }