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

Adding angle to Ray.Direction?

Asked by
drahsid5 250 Moderation Voter
8 years ago

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

Log in to vote
0
Answered by 8 years ago

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.

Ad

Answer this question