internal void DestroyProxies(DynamicTree <FixtureProxy> fixtureTree) { // Destroy proxies in the broad-phase. for (int i = 0; i < ProxyCount; ++i) { fixtureTree.RemoveProxy(Proxies[i].ProxyId); Proxies[i].ProxyId = -1; } ProxyCount = 0; }
private void DestroyProxy() { for (int i = 0; i < ActorCount; ++i) { int j = Rand.Random.Next() % ActorCount; Actor actor = _actors[j]; if (actor.ProxyId != -1) { _tree.RemoveProxy(actor.ProxyId); actor.ProxyId = -1; return; } } }
public void TestManipulation() { var tree = new DynamicTree(); var aabb1 = new AABB(new Vector2D(21.9995f, 1.4995f), new Vector2D(28.0005f, 2.2005f)); var proxy1 = tree.AddProxy(aabb1, null); Assert.AreEqual(1, tree.Count); Assert.AreEqual(0, proxy1.Depth); Assert.IsTrue(proxy1.IsLeaf); Assert.IsTrue(proxy1.IsRoot); var aabb2 = new AABB(new Vector2D(21.9995f, 1.9995f), new Vector2D(22.5005f, 3.7005f)); var proxy2 = tree.AddProxy(aabb2, null); Assert.AreEqual(3, tree.Count); Assert.AreEqual(0, proxy2.Depth); Assert.IsTrue(proxy2.IsLeaf); Assert.IsFalse(proxy2.IsRoot); var aabb3 = new AABB(new Vector2D(27.4995f, 4.9995f), new Vector2D(28.0005f, 6.7005f)); var proxy3 = tree.AddProxy(aabb3, null); Assert.AreEqual(5, tree.Count); Assert.AreEqual(0, proxy3.Depth); Assert.IsTrue(proxy3.IsLeaf); Assert.IsFalse(proxy3.IsRoot); var aabb4 = new AABB(new Vector2D(23.4495f, 1.1495f), new Vector2D(24.9505f, 3.8505f)); var proxy4 = tree.AddProxy(aabb4, null); Assert.AreEqual(7, tree.Count); Assert.AreEqual(0, proxy4.Depth); Assert.IsTrue(proxy4.IsLeaf); Assert.IsFalse(proxy4.IsRoot); tree.RemoveProxy(proxy2); Assert.AreEqual(5, tree.Count); Assert.AreEqual(2, tree.FreeCount); Assert.AreEqual(-1, proxy2.Depth); Assert.IsTrue(proxy2.IsFree); aabb4 = new AABB(new Vector2D(23.8495f, 5.9495f), new Vector2D(25.3505f, 8.6505f)); tree.MoveProxy(proxy4, aabb4, new Vector2D(1, 1)); Assert.AreEqual(5, tree.Count); Assert.AreEqual(2, tree.FreeCount); }