After looking into a roblox tutorial for raycasting, I have come across something quite puzzling(I am not very good with math,that's why I ask). The distance value in the beams CFrame is negative, and divided by 2, can someone tell me why each one of those two things are?
beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
Larger chunk of script:
local distance = (tool.Handle.CFrame.p - position).magnitude
beam.Size = Vector3.new(0.3, 0.3, distance)
beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)

4 comments
it's making distance a negative number and dividing it by 2
I know that silly, what i'm trying to figure out is what effect it will have on the ray
play with it. Change the 2 to different numbers. Instead of dividing, multiply, add, or subtract it to see the effect it has.
I wouldn't be here if I hadnt already tried that, from what I can tell undoing the negative has no effect, and I think that removing the 2 makes it shorter