Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you do surface detection with raycasting?

Is their any way to detect what surface of a part a ray hits?

No code because I have absolutely no clue on what to do after the ray hits a part.

1 answer

✓ Accepted answer

Reading the wiki page will help.

FindPartOnRay returns three things:

  1. The Part (if any) that the Raycast hit
  2. The Position (if any) that the Raycast hit the Part at
  3. The Vector of the surface normal that corresponds with the Surface hit by the Raycast (if any)

The third return is what you're interested in.

As I've already answered how to convert that vector into the hit Surface, read my answer to this question.

This discussion is preserved as it was. New answers, comments, and votes are closed.