I want to raycast from a part’s position directly downwards and if any part is hit then it would generate a second part visualizing the hit.
I’m not sure why but it is acting like a lerp function? It generates parts from an offset and those parts get closer and closer to the casting position.
https://gyazo.com/0269d5a902af7362599a7f2be0896d3e
https://gyazo.com/64c7a050ecda8d0401f671c42f9aca87
https://gyazo.com/923730fec2a23ead6b083e56aa5bc9d3
I’ll try solving it, but any reply could potentially speed up the process, in which case I’d be very grateful.
while true do
local params = RaycastParams.new()
params.FilterDescendantsInstances = {script.Parent}
params.FilterType = Enum.RaycastFilterType.Blacklist
local raycastAttempt = workspace:Raycast(script.Parent["1"].Position, script.Parent["1"].Position + (Vector3.fromNormalId(Enum.NormalId.Bottom) * 10), params)
if raycastAttempt then
print("Hit!")
print("Raycast_Attempt: ",raycastAttempt.Position)
print("Start_Point: ", script.Parent["1"].Position)
print("Finish_Point: ",script.Parent["1"].Position + (Vector3.fromNormalId(Enum.NormalId.Bottom) * 10))
local part = Instance.new("Part")
part.CFrame = CFrame.new(raycastAttempt.Position)
part.Name = "Visualization"
part.Size = Vector3.new(1,1,1)
part.Anchored = true
part.CanCollide = false
part.Material = raycastAttempt.Material
part.Color = Color3.new(255,0,0)
part.Parent = workspace
end
wait(1)
end