Sign in to follow this  

ray casting and character world view area

This topic is 3112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hy. I'm still searching for a ray casting / view of character(the area of view of the character in the world). This is the base of my Controller AI(i'm use a MVC pattern for my game),shoul advice to me tutorials or a good book? Thanks.

Share this post


Link to post
Share on other sites
Ray casting won't help you that much for general characters. Their field of view is a cone which you can simplify to a frustum (four sided pyramid) starting at their head position running along their view direction.

You then need to specify the vertical und horizontal field of view in radians (typically your horizontal FOV is about 180 degree while the vertical is a bit less. Doing some trigonometry on the resulting orthogonal triangles (having the angle and the viewing distance) lets you calculate the area which can be seen by your characters.

If that is not what you want you have to be more specific with your question.

Share this post


Link to post
Share on other sites
The point of ray casting is that it will tell you what objects cannot be seen because they are occluded, which a simple frustum won't do.

The trick is to sample rays all over the frustum. To avoid sampling too many rays, try to sample on the border of the object you last hit.
Search for potentially visible set, you should find information on the subject.

Share this post


Link to post
Share on other sites

This topic is 3112 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this