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

Trying to cast rays out of players head to visualize FOV?

I am attempting to cast rays out of a players head to visualize FOV so I can create a "fog of war" system.

I cant seem to get the math right. Currently it seems the rays shoot -90 degrees to the left of the players lookvector, and as I get farther away from 0,0,0 the rays get closer together.

Heres my code. Its on a code share because I cant seem to ever get the code thing working on this website.

https://codeshare.io/5g18Ny

Here also a gif of whats happening. [https://gyazo.com/2f7bff6a94b544e469ad4a3ec1674b27]

Thanks and hopefully we can figure this out :)

1 answer

I’m a bit confused but do you mean FOV as in like how much you can see? Roblox actually has that covered with the CurrentCamera object. You just need to get it from a LocalScript and then change the FieldOfView property to whatever you like.

If it is something else then tell me

2 comments

0

Totally understandable. I am trying to create a FOV for the character. It doesnt relate to camera FOV at all. I just need help correcting my ray casting math.

0

I saw the gyazo link and I’m not too great with raycasts but how are you updating/firing the raycasts? Are you using run service for it?

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