How would I put an offset inside my raycast for it to act like spray?
heres what I have now
local ServerRaycastVerify = workspace:Raycast(playerPos, DirectionServer, ServerParams)
the directionserver shoots towards the player but i wanna add an offset like +4 studs to random side depending if theyre moving etc, i just need to know how to implement the spray ontop of the direction already, thanks
To improve on this, using CFrames usually works really well.
local direction = CFrame.LookAt(startpos, targetpos, Vector3.new(0,1,0))
Then multiply with another CFrame that has random angles applied to it.
local x, y = math.rad(math.random(-10, 10)), math.rad(math.random(-10, 10))
direction *= CFrame.Angles(x, y, 0)
local dir_vector = direction.LookVector.Unit * max_distance