I am writing a script to remove parts/brcks in a wall but havig issues finding a way to make parts/bricks unanchored if the is nothing below to support it so they fall.
I am using a local script in a tool to remove the parts/bricks when touched.
Thanks, I have written a test but it keeps returning nil even though it should find the baseplate
local rParams = RaycastParams.new()
rParams.FilterType = Enum.RaycastFilterType.Blacklist
rParams.FilterDescendantsInstances = {workspace.Trees}
-- Brick to check
local origin = Vector3.new(game.Workspace.Brick1.Position.X,game.Workspace.Brick1.Position.Y - game.Workspace.Brick1.Size.Y,game.Workspace.Brick1.Position.Z)
-- Direction to check starting just part the brich to check
local direction = Vector3.new(origin.X ,origin.Y - game.Workspace.Brick1.Size.Y - 2,origin.Z)
local raycastResult = workspace:Raycast(origin,direction,rParams)
print("Result = " .. tostring(raycastResult))
local rParams = RaycastParams.new()
rParams.FilterType = Enum.RaycastFilterType.Blacklist
rParams.FilterDescendantsInstances = {workspace.Trees}
-- Brick to check
local origin = Vector3.new(game.Workspace.Brick1.Position.X,game.Workspace.Brick1.Position.Y - (game.Workspace.Brick1.Size.Y/2),game.Workspace.Brick1.Position.Z)
-- Direction to check starting just part the brich to check
local direction = Vector3.new(0 , -0.1, 0)
local raycastResult = workspace:Raycast(origin,direction,rParams)
print("Result = " .. tostring(raycastResult))
You had the direction a little off and the origin position would be way below the bottom of the part depending on the size