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

How do I make Raycasting "Wider"?

Asked by
neoG457 315 Moderation Voter
8 years ago

I have this script that fires a ray that hits anything within 5 studs of the Player's torso but it seems to only fire in a small straight line making it hard for the ray to hit moving targets. Is there a way to make rays "wider"?

local PUNCH_RANGE = 5
local torso = Player.Character.Torso
local ray = Ray.new(torso.Position, torso.CFrame.lookVector * PUNCH_RANGE)
local part, endPoint = workspace:FindPartOnRay(ray, Player.Character)

1 answer

Log in to vote
1
Answered by 8 years ago

The short answer: You can't.

The long answer: Rays are simply lines. That's it. They don't have a width, they only can detect things along its path. Maybe you can make multiple rays in a circle if you need to.

0
wow. neoG457 315 — 8y
1
Not sure if this would work, but try adding an animation function to the part that increases the size. I just barely learned how to create Rays myself a few hours ago, and I found some cools tricks that helped. OneTruePain 191 — 8y
Ad

Answer this question