Add HC.clear()

This commit is contained in:
Matthias Richter 2011-08-12 13:00:54 +02:00
parent eb2ef94212
commit 5aa6b335be

View File

@ -53,6 +53,14 @@ function init(cell_size, callback_collide, callback_stop)
is_initialized = true is_initialized = true
end end
function clear()
hash = Spatialhash(hash.cell_size)
active_shapes, passive_shapes, ghosts = {}, {}, {}
current_shape_id = 0
shape_ids = setmetatable({}, {__mode = "k"})
groups = {}
end
function setCallbacks(collide, stop) function setCallbacks(collide, stop)
if type(collide) == "table" and not (getmetatable(collide) or {}).__call then if type(collide) == "table" and not (getmetatable(collide) or {}).__call then
stop = collide.stop stop = collide.stop