HasVisualContact

Check if has visual contact with target

Usage: Used in 2 task(s)

Lua Implementation

-- Has Visual Contact
function evaluate(params)
    local target = params.target
    local visualRange = params.visual_range or 5000

    if not target or not target:isValid() then
        return false
    end

    local distance = spatialUtil.distance(this:getLocation3D(), target:getLocation3D())
    return distance <= visualRange and this:hasLosToObject(target)
end