how can i know .....????

how can i know if a click in the screem is in 3d object .( i mean if i want to drag some object , i need to know at the fush if it was in the object i want to drag)

thanks u all?

Read about selection buffer, this is what you need.

You can cast a ray from mouse position to viewer’s direction and check if it hits any object with the ray-plane collision technique

Casting a ray and testing with all polygons (or all frontfacing polygons) can cost alot…

What I did was pre-compute the OBB Trees of the meshes (useful for collision detection as well) and use the intersection of a ray and OBB tree to determine which polygon (if any) was hit. It’s pretty fast and accurate, and can be accelerated even more if you first test the ray with the bounding spheres of the objects before passing to the OBB trees.

This technique gives other information which can be useful, such as distance from the cast point (the mouse click on the front clipping plane) to the object selected.

Cheers !