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

How do I use rays? (simple questions in desc)

Asked by 4 years ago
Edited by User#5423 4 years ago

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?
0
edit:- fixed formatting User#5423 17 — 4y
0
hey man i need more help on the scripting part javont_sav21 2 — 4y
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 Rinpix 639 — 4y
0
That's actually super useful, thanks Heavenlyblobmaster 271 — 4y

Answer this question