Is there any way to for example, fire a raycast up and down simultaneously? I’ve tried an array for it. Like:
local raycastOrigin1 = workspace.Altar.CenterPart.Position
local RayDirection1 = { --error
Vector3.new(0,10,0),
Vector3.new(0,-10,0)
}
local RaycastParams1 = RaycastParams.new()
RaycastParams1.FilterDescendantsInstances = {workspace.Altar}
RaycastParams1.FilterType = Enum.RaycastFilterType.Blacklist
local RaycastResult = workspace:Raycast(raycastOrigin1, RayDirection1, RaycastParams1)
But it doesn’t seem to work.
7z99
(cody)
February 10, 2022, 3:59am
#2
You have to cast 2 rays:
local resultUp = workspace:Raycast(raycastOrigin1, Vector3.new(0,10,0), RaycastParams1)
local resultDown = workspace:Raycast(raycastOrigin1, Vector3.new(0,-10,0), RaycastParams1)
1 Like
cjhatter
(can)
February 10, 2022, 4:06am
#3
or he could start the raycast 10 studs below the origin point thus creating an makeshift up and down raycast
7z99
(cody)
February 10, 2022, 4:08am
#4
Yeah but if there is an object above and below, it would only return one object, or if there’s an object between the two at the origin, that would also cause an undesired result. Two rays are sometimes more useful than one.
2 Likes
Thanks! I had no idea you needed two different rays in order to do this.
1 Like