RayCheck||doc136432

September 20, 2022

Format

Map:RayCheck(startPos, direction, distance)

Describe

Get whether the radiographic test has hit. Better performance thanMap:RayCast()

parameter

Variable name Type Describe
startPos Vector3 Ray starting point
direction Vector3 Ray direction, default vector3 Zero
distance float Ray distance

Return value

Type Describe
bool Detect whether it hits

Code example

Check whether the ray between the five units to the right of the current scene coordinate (0,1,0) hits the collision body at the client

local map = World.CurMap
local startPos = Vector3.new(0,1,0)
local direction = Vector3.Right
local distance = 5
local check = map:RayCheck(startPos, direction, distance)
print(check)