Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: how can i know .....????

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2003
    Posts
    2

    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?

  2. #2
    Junior Member Regular Contributor
    Join Date
    Sep 2002
    Location
    Poland
    Posts
    196

    Re: how can i know .....????

    Read about selection buffer, this is what you need.

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2001
    Location
    Italy
    Posts
    21

    Re: how can i know .....????

    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

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    4

    Re: how can i know .....????

    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 !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •