Skip to content

Commit 7967e31

Browse files
committed
Update functions.lua
1 parent 0c5306b commit 7967e31

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

scripts/python/API/plugins/lua_link/lua/functions.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,15 +446,20 @@ function olyLink.clearZone(zoneName)
446446
id = world.VolumeType.SPHERE,
447447
params = {
448448
point = mist.utils.makeVec3GL(zone.point),
449-
radius = zone.radius
449+
radius = 5000
450450
}
451451
}
452452

453453
local foundObjects = 0
454454
local function tryRemove(obj)
455455
foundObjects = foundObjects + 1
456456
if obj and obj:isExist() then
457-
obj:destroy()
457+
-- Check if the distance between the object and the zone center is less than the zone radius, ignoring height
458+
local objPosition = obj:getPosition().p
459+
local distance = math.sqrt((objPosition.x - zone.point.x)^2 + (objPosition.z - zone.point.z)^2)
460+
if distance <= zone.radius then
461+
obj:destroy()
462+
end
458463
end
459464
return true
460465
end

0 commit comments

Comments
 (0)