Fix center of bounding box calculation

This commit is contained in:
Elias Åström 2021-02-16 21:33:26 +01:00
parent 24c14e7f15
commit d5ea06bb47

View file

@ -255,9 +255,9 @@ local function trace_explode(pos, strength, raydirs, radius, info, puncher)
local z_len = math.abs(z2 - z1) local z_len = math.abs(z2 - z1)
-- Move object position to the center of its bounding box -- Move object position to the center of its bounding box
opos.x = opos.x + x1 + x2 opos.x = opos.x + 0.5 * (x1 + x2)
opos.y = opos.y + y1 + y2 opos.y = opos.y + 0.5 * (y1 + y2)
opos.z = opos.z + z1 + z2 opos.z = opos.z + 0.5 * (z1 + z2)
-- Count number of rays from collision box which are unobstructed -- Count number of rays from collision box which are unobstructed
local count = N_EXPOSURE_RAYS local count = N_EXPOSURE_RAYS