Sign in to follow this  
John Stuart

How to know if the object is behind a wall/tree?

Recommended Posts

Quote:
Does raycasting suited on this?
Sure :)

The details of course will depend on various factors, such as whether the simulation is 2-d or 3-d, what spatial partitioning scheme (if any) is being used, etc.

(I assume that when you say 'behind a wall/tree', you mean relative to a specific viewing position.)

Share this post


Link to post
Share on other sites
Well, I tried using raycast but my problem is that the ray should cast only a straight line perpendicular to the camera (plane) because if it did cast a ray that is not perpendicular to the camera, it hits some objects that should not.

Is there any formula on how to get? I'm using 3d by the way.

Share this post


Link to post
Share on other sites
either cast a ray from the eye position to the center of the object or do occlusion queries.

http://www.gamedev.net/reference/programming/features/occlusionculling/

This is direct x 9 but maybe it'll still give you an idea, I've seen similar technique in opengl too (GPU gems book 1 (availible online on nvidias' website))

Share this post


Link to post
Share on other sites

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