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

How can I see which surface a ray is pointing to?

Asked by
IDKBlox 349 Moderation Voter
5 years ago
Edited 5 years ago

I know that you can get the surface using the third argument in the ray.

Is there a clean way to set that up?

I've looked through many different websites and I can't find anything even somewhat close. What I have now works fine until I cast it at a rotated part Somone know?

``` local x,y,z = norm.X, norm.Y, norm.Z

print(x,y,z)

local surf = 'Front'

if x ~= 0 and (y == 0 and z == 0) then if x > 0 then surf = 'Right' else surf = 'Left' end elseif y ~= 0 and (x == 0 and z == 0) then if y > 0 then surf = 'Top' else surf = 'Bottom' end elseif z ~= 0 and (x == 0 and y == 0) then if z > 0 then surf = 'Back' else surf = 'Front' end end ```

0
I'm pretty sure that Rays have lookVectors. DeceptiveCaster 3761 — 5y
0
Hmm, I'll check that out and let you know. Thanks! IDKBlox 349 — 5y
0
Yeah I appreciate that.. I just tried it lol and yeah it seems that doesn't work with rotated parts either xD IDKBlox 349 — 5y

Answer this question