New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Still have questions? Join our Discord server and get real time help.
Log in to vote

Can someone explain the logic of this ray problem?

Asked by 8 days ago

This is the popular choice of how to create a ray:

local ray =, (workspace.PART2.Position - script.Parent.Position).Unit*300)

And this is another way:

local ray =, (workspace.PART2.Position).Unit*300)

Could someone explain to me why the first one works while the second one does not? I really do not see why subtracting the origin position helps.

The direction argument in Ray() is not a Position Vector3, it is an angular Vector 3. That discribes in witch angle the ray will be casted, and not the position the ray will be faced to. Necro_las 84 — 8d

Answer this question