• Advertisement
Sign in to follow this  

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

This topic is 2853 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

Advertisement
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
Quote:
Is there any formula on how to get?
Not sure I understand - how to get what?

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
Sign in to follow this  

  • Advertisement