Hello, I am fairly new to lua and roblox scripting, How would I go about casting a ray downward at a 45 degree angle from the torso/humanoidrootpart? I have browsed a few other forum posts and none of the way's have worked for me. Here's what I was able to do but downwards was not successful neither was a 45 degree angle. Any help will be appreciated.
local player = game.Players.LocalPlayer
local char = player.Character
local torso = char.HumanoidRootPart
local origin = torso.Position
local direction = torso.CFrame.LookVector * 100
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {char}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(origin, CFrame.Angles(0,math.rad(90),0).lookVector * direction, raycastParams)
if raycastResult then
print(raycastResult.Instance)
else
print("hit nothing")
end
If I have worded this wrong this is what I want to happen

2 comments
You're Raycasting ninety degrees upward. As the rules of a Cartesian coordinate illustrate, a negative Y-position will reach downward, therefore you must reformat your Vector like so: 'CFrame.Angles(0, math.rad(-45), 0).LookVector * Scale.'
Hello thank you for the post, this also worked when I put it on the X and not the Y axis.