Developer knowledge network · moderated exchange

Сообщество UnreliableCode

Сообщество разработчиков, обратного проектирования и кодирования

Tutorial

Luau Raycast visualization & Wall-Check algorithms in 3D space

raycast_ryan
Ballistics Dev
MEMBER
Представитель: 72
Дата присоединения: Sep 2019
Сообщения: 32
Спасибо: 16
3 недель назад · Jul 29, 2026 11:51 PM
#1

To check if an enemy is behind a wall before triggering aimbot in Roblox:

LUA
local function IsVisible(targetHeadPos)
    local camera = workspace.CurrentCamera
    local origin = camera.CFrame.Position
    local direction = (targetHeadPos - origin)
    
    local raycastParams = RaycastParams.new()
    raycastParams.FilterDescendantsInstances = { game.Players.LocalPlayer.Character, camera }
    raycastParams.FilterType = RaycastFilterType.Exclude
    raycastParams.IgnoreWater = true
    
    local result = workspace:Raycast(origin, direction, raycastParams)
    if not result then return true end -- No obstacle hit, target is visible!
    
    -- Check if hit object is part of the enemy player character
    return result.Instance:IsDescendantOf(targetHeadPos.Parent)
end
luau_hacker
Luau Expert
MEMBER
Представитель: 159
Дата присоединения: Aug 2020
Сообщения: 17
Спасибо: 26
3 недель назад · Jul 30, 2026 2:18 AM
#2

RaycastParams.FilterType = RaycastFilterType.Exclude is the modern replacement for legacy RaycastFilterType.Blacklist. Fast and clean.

matrix_math_guy
Math Specialist
MEMBER
Представитель: 105
Дата присоединения: Aug 2018
Сообщения: 52
Спасибо: 41
3 недель назад · Jul 30, 2026 12:21 PM
#3

Eliminates shooting at targets hidden behind thick concrete walls.