   How to know if the object is behind a wall/tree?
  Any idea how to do this? Does raycasting suited on this?   
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.)   ;  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.   ;Quote:Is there any formula on how to get?Not sure I understand - how to get what?   ;  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))   