I’m making a gun for my game but I need to add spread, can you tell me how?
The direction parameter of the raycast should be something like this:
local dist = (mouseHitPos - startPos).Magnitude
local RayDirection = ((mouseHitPos + Vector3.new(Spread * dist/20, Spread * dist/20, Spread * dist/20)) - startPos).unit * Range
This is my method of raycasting with spread ^^
Lmk if there are any issues regarding my idea or code
where is the value “spread” defined?
just put it in a variable somewhere above.
Just define it by yourselves, I didn’t define spread just to give you a little idea on how to implement spread, not to write an entire script.