Raycasts not working as desired

example of what I mean

the green lines are the ray casts or what I think the ray casts are doing but it seems like they are checking to the left of the line instead of infront of it. Which is confusing but somethings they work as expected and check the collision in front and other times I don’t even know what is happerning with the rays because they seem to randomly go off.


--bullets[i][1] is basically the cameras CFrame
local raycastResult = workspace:Raycast(bullets[i][1].Position, bullets[i][1]*CFrame.new(0,0,-3).Position, raycastParams)
local rayChecker = game.Workspace:WaitForChild("raychecker"):Clone()
rayChecker.Parent = workspace:WaitForChild("Bullets")
rayChecker.CFrame = bullets[i][1]*CFrame.new(0,0,-1)

Raycast’s second item needs a direction and not a position try using bullets[i][1].LookVector*3 instead of bullets[i][1].LookVector*Cframe.new(0,0,-3)

1 Like

it worked :slight_smile: but I don’t understand the difference because they are both vector 3s

Basically a position is where a point is in the world and a direction is where it is looking at or facing.