I'm a dev, but one thing I'd like to understand is rays. So, if you can, answer these basic questions for me, pls:

(yes i know a ray is a line with 1 definitive start point but no end point)

  • How do you cast a ray?
  • Is a ray constructed all at once or does it move fast from its startpos to where you want it?
  • Can you control the speed it goes at?
  • Can you detect when it is touching a part?

4 comments

0

edit:- fixed formatting

0

hey man i need more help on the scripting part

1

Ray.new(position, direction) creates a ray starting at the given position, and casts it in the direction provided. From my understanding, a ray is created pretty much instantaneously. No. You can't control its speed. Yes, you can detect when it's touching a part. https://developer.roblox.com/en-us/api-reference/function/WorldRoot/FindPartOnRay

0

That's actually super useful, thanks