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

Adding angle to Ray.Direction?

So I want to create a field of view without using :GetTouchingParts(), 7 rays rather. (If there's a better method for this, I'd love to know.) I'm trying to see if the player is obscured by a brick, if it's in the AIs view. I have tried using the lookVector of the player's torso, just subtracting from the torso's position and CFrame.Angles() (Which all, did not work.) Can anyone help?

1 answer

✓ Accepted answer

The lookVector of the player's torso is merely what direction the player's character is currently facing.

You need to cast (FindPartOnRay) a Ray from the AI to the player and see if it runs into anything that counts as an obstacle.

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