mirror of
https://github.com/vrld/HC.git
synced 2024-11-18 12:54:23 +00:00
Finally fix #28 - shapes not removed properly on
A shape added with HC:add*() would be reintroduced to the spatial hash after HC:remove() when any of shape:move(), shape:rotate() or shape:scale() was called after the removal.
This commit is contained in:
parent
fb8c0511cf
commit
79c3d0abf8
9
init.lua
9
init.lua
@ -107,16 +107,17 @@ function HC:addShape(shape)
|
||||
end
|
||||
end
|
||||
|
||||
function shape:_removeFromHash()
|
||||
shape.move, shape.rotate, shape.scale = move, rotate, scale
|
||||
return hash:remove(shape, self:bbox())
|
||||
end
|
||||
|
||||
function shape:neighbors()
|
||||
local neighbors = hash:inRange(self:bbox())
|
||||
rawset(neighbors, self, nil)
|
||||
return neighbors
|
||||
end
|
||||
|
||||
function shape:_removeFromHash()
|
||||
return hash:remove(shape, self:bbox())
|
||||
end
|
||||
|
||||
function shape:inGroup(group)
|
||||
return self._groups[group]
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user