Making this topic simple.
I’m trying to cast a ray that starts from the HumanoidRootPart and ends Directly underneath the HumanoidRootPart. So hypothetically saying I would need the direction of the ray to move towards the a position using this line: HumanoidRootPart.Position - Vector3.new(0,50,0)
.
From first expectations, it should atleast cast the ray DIRECTLY UNDERNEATH the character, hitting the floor. But I get this as a result instead:
There’s a possibility that I’m doing this incorrectly but, here’s the line of code:
local Raycast = workspace:Raycast(HRP.Position,HRP.Position - Vector3.new(0,50,0), RayParam)
local Distance = (HRP.Position - Vector3.new(0,50,0)).magnitude
local Laser = Instance.new("Part")
Laser.Name = "RayPart"
Laser.BrickColor = BrickColor.new("Really red")
Laser.Material = Enum.Material.ForceField
Laser.Transparency = 0
Laser.Anchored = true
Laser.CanCollide = false
Laser.TopSurface = Enum.SurfaceType.Smooth
Laser.BottomSurface = Enum.SurfaceType.Smooth
Laser.formFactor = Enum.FormFactor.Custom
Laser.Size = Vector3.new(.1, .1, Distance)
Laser.CFrame = CFrame.new(HRP.Position, Raycast.Position) * CFrame.new(0, 0, -Distance/2)
Laser.Parent = game.Workspace.Debris
game.Debris:AddItem(Laser,1)