Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Adding a spread to Rays using raycasting?

Asked by 6 years ago
local distance = (tool.Shoot.CFrame.p - position).magnitude
beam.Size = Vector3.new(0.1, 0.1, distance)
beam.CFrame = CFrame.new(tool.Shoot.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)

I'm trying to figure out how to make my ray 'spread' out, so it doesn't end up at the exact location of where the player clicked.

Trying to use raycast for a paintball game, would this be the best way to do it? Played games like Mad Paintball 2, and it looks like that uses raycast, but it has some randomness to where the bullet actually hits. I'm just using the script provided on the Roblox wiki as well.

0
Instead of modifying where the beam is going, modify the actual ray. Mineloxer 187 — 6y

Answer this question