public bool MoveProxy(int proxyId, ref b2AABB aabb, ref b2Vec2 displacement) { Debug.Assert(0 <= proxyId && proxyId < m_nodeCapacity); Debug.Assert(m_nodes[proxyId].IsLeaf()); if (m_nodes[proxyId].aabb.Contains(ref aabb)) { return(false); } RemoveLeaf(proxyId); // Extend AABB. b2AABB b = aabb; b.Fatten(); // Predict AABB displacement. // d = b2Settings.b2_aabbMultiplier * displacement; float dx = b2Settings.b2_aabbMultiplier * displacement.x; float dy = b2Settings.b2_aabbMultiplier * displacement.y; if (dx < 0.0f) { b.LowerBound.x += dx; } else { b.UpperBound.x += dx; } if (dy < 0.0f) { b.LowerBound.y += dy; } else { b.UpperBound.y += dy; } m_nodes[proxyId].aabb = b; InsertLeaf(proxyId); return(true); }
public bool MoveProxy(int proxyId, b2AABB aabb, b2Vec2 displacement) { Debug.Assert(0 <= proxyId && proxyId < m_nodeCapacity); Debug.Assert(m_nodes[proxyId].IsLeaf()); if (m_nodes[proxyId].aabb.Contains(ref aabb)) { return(false); } RemoveLeaf(proxyId); // Extend AABB. b2AABB b = aabb; b.Fatten(); // Predict AABB displacement. b2Vec2 d = b2Settings.b2_aabbMultiplier * displacement; if (d.x < 0.0f) { b.LowerBoundX += d.x; } else { b.UpperBoundX += d.x; } if (d.y < 0.0f) { b.LowerBoundY += d.y; } else { b.UpperBoundY += d.y; } b.UpdateAttributes(); m_nodes[proxyId].aabb = b; InsertLeaf(proxyId); return(true); }