Nez.Portable/Physics/SpatialHash.cs
/// <summary>
/// removes the object from the SpatialHash
/// </summary>
/// <param name="collider">Collider.</param>
removes the object from the SpatialHash
removes the object from the SpatialHash
public void remove(Collider collider)
        {
            var bounds = collider.registeredPhysicsBounds;
            var p1 = cellCoords(bounds.x, bounds.y);
            var p2 = cellCoords(bounds.right, bounds.bottom);
            for (var x = p1.X; x <= p2.X; x++)
            {
                for (var y = p1.Y; y <= p2.Y; y++)
                {
                    var cell = cellAtPosition(x, y);
                    Assert.isNotNull(cell, "removing Collider [{0}] from a cell that it is not present in", collider);
                    if (cell != null)
                        cell.Remove(collider);
                }
            }
        }
public void remove ( Collider collider ) { var bounds = collider . registeredPhysicsBounds ; var p1 = cellCoords ( bounds . x , bounds . y ) ; var p2 = cellCoords ( bounds . right , bounds . bottom ) ; for ( var x = p1 . X ; x <= p2 . X ; x ++ ) { for ( var y = p1 . Y ; y <= p2 . Y ; y ++ ) { var cell = cellAtPosition ( x , y ) ; Assert . isNotNull ( cell , " " , collider ) ; if ( cell != null ) cell . Remove ( collider ) ; } } }
removes the object from the SpatialHash
removes the object from the SpatialHash
// the cell should always exist since this collider should be in all queryed cells
collider
Collider
None