How to visualize block cast

I have been thinking about this problem for a few day and still cant come up with a solution since this is much harder than visualizing raycast
and yes I am aware that someone has already made shape cast visualize module on DevForum before but I want to make my own module so I can learn more stuff and expand my knowledge

5 Likes

for anyone who are still looking for the answer, here’s how you do it

Part = script.Parent

local NewParams = RaycastParams.new()
NewParams.FilterType = Enum.RaycastFilterType.Exclude

local PartClone = Part:Clone()
PartClone.Script:Destroy()
PartClone.Anchored = true
PartClone.Transparency = 0.5
PartClone.Name = "PartClone"
PartClone.Parent = workspace

NewParams.FilterDescendantsInstances = {Part,PartClone}

game:GetService("RunService").Heartbeat:Connect(function()
	local Result = workspace:Blockcast(Part.CFrame,Part.Size,Part.CFrame.LookVector * 100,NewParams)
	if Result then
		PartClone.Position = Part.Position + Part.CFrame.LookVector * Result.Distance
		PartClone.Orientation = Part.Orientation
	end
end)

I just randomly came up with the solution today and it was much more simpler than I thought

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.