BoxCast||doc136436

September 20, 2022

Format

Map:BoxCast(center, extend, rotation)

Describe

Get the hit information of box detection. Performance worse thanMap:BoxCheck()

parameter

Variable name Type Describe
center Vector3 Box center point
extend Vector3 Side length of box type
rotation Vector3 The rotation direction of the box type is vector3 by default Zero

Return value

Type Describe
table<HitResult> A list of all detected hit information, each hit information contains information such as the instance of the hit, the distance of the hit, etc.

Code example

Check the current scene coordinates (0,0,0) on the client, and a list of instances of box detection hits per unit volume

local map = World.CurMap
local center = Vector3.new(0,0,0)
local halfExtend = Vector3.new(0.5,0.5,0.5)
local resultList = map:BoxCast(center, halfExtend)
for _, result in pairs(resultList) do
    print(result.Instance)
end