Help with understanding blockcast

I have a question about the arguments passed into workspace:Blockcast.

Blockcast takes a cframe(position + rotation), a size, and a direction.
If I set the cframe to look in a specific direction and make the size.Z into my distance magnitude, what would the direction argument do?

Example, I want to Blockcast to the ground. Is this the correct way of doing it?

local Position = Vector3.new(0, 4, 0)
local Direction = Vector3.new(0, -1, 0)
local Distance = 5
local Size = Vector3.new(2, 2, Distance)
local BlockCast = workspace:Blockcast(CFrame.new(Position, Position+Direction), Size, Direction * Distance)
1 Like

Am I supposed to just get rid of the Z part of my Size? It confuses me for some reason.

You don’t need the Position+Direction part for the CFrame.new(). You only need the CFrame.new(Position) part. You specify the direction in the :Blockcast method anyway.
No, 5 is a really small distance. People normally do 100-1000 for raycasts, so it should be similar for shapecasts.
WorldRoot | Documentation - Roblox Creator Hub is the full documentation. There are examples too.

1 Like