mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-25 16:53:46 +01:00
Move box_box_collision to vector & fix it
This commit is contained in:
parent
27b2de0367
commit
7fde587dab
@ -101,15 +101,6 @@ function check_player_privs(playername, privtable)
|
||||
return missing_privs, to_lose_privs
|
||||
end
|
||||
|
||||
function box_box_collision(a, b)
|
||||
for i=1, 3 do
|
||||
if a[i] < (b[i] + b[i+3]) or b[i] < (a[i] + a[i+3]) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for k, v in pairs(delta_times) do
|
||||
local v=dtime+v
|
||||
|
@ -76,4 +76,13 @@ end
|
||||
|
||||
function clamp(v, min, max)
|
||||
return apply(apply(v, math.max, min), math.min, max)
|
||||
end
|
||||
|
||||
function box_box_collision(diff, box, other_box)
|
||||
for index, diff in pairs(diff) do
|
||||
if box[index] + diff > other_box[index + 3] or other_box[index] > box[index + 3] + diff then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
Loading…
Reference in New Issue
Block a user