[gameprogrammer] Re: OpenGL and mouse click location
- From: Frank Herrera <frankherrera@xxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Sat, 9 Apr 2005 18:13:08 -0600
Hi guys, i'm not the OP but I had a question concerning this 'picking'
or 'selection' method.
I'm working on a 3d space fighter like clone. The turret is located
at the bottom of the screen and whenever I click on something I would
shoot it. (right now, soon it will change to a more FPS like scene).=20
In any case, I've been reading on collision detection methods and most
involve planes and spheres and other complicated math. (well it's not
complicated but still :) Ans i'm wondering, as far as just clicking
and shooting and seeing if I hit whatever is in the current "area"
around where the mouse pointer is.. why I wouldn't use the 'picking'
method to simplify things.
The only thing I can think of, is if there was an object closer that
gets hit before wherever I am clicking. Anyone have other thoughts.=20
This is only for shooting a laser and what object it hits collision
detection, not object to object collision detection.
Thanks,
Frank
On 4/6/05, Alan Wolfe <alan.wolfe@xxxxxxxxx> wrote:
> What you want to do is look up "Picking" mode in GL or "selection"
> mode as it is also called, check this out:
>=20
> http://www.lighthouse3d.com/opengl/picking/
>=20
> basicly what it does is make it so you can tell which objects are
> drawn under the mouse position. This is super awesome and useful
> cause then you can have a super complicated 3 shape full of holes and
> still be able to tell when the mouse is over it.
>=20
> zooming in and out dont complicate things, as this will still tell you
> whats drawn under the mouse, no matter what it's distance from the
> camera is (;
>=20
> On Apr 6, 2005 9:08 AM, tobias.langner@xxxxxxxxxxx
> <tobias.langner@xxxxxxxxxxx> wrote:
> > Hi everybody,
> >
> > I'm trying to write a tile-based game in OpenGL/SDL. The camera looks
> > directly down on the map (no isometric view, just top-down). The
> > scrolling is realised via translating the map and zooming is realised b=
y
> > changing the angle in gluPerspective. So the map remains at a fixed
> > z-coordinate (10 in my case).
> > The tiles are textured quads using pngs as textures.
> >
> > My question is: How do I determine which tile the user clicked on? Even
> > an algorithm without the zoom and scrolling would be perfect since the
> > rest is easy.
> >
> > Best regards, Tobias
> >
> > ---------------------
> > To unsubscribe go to http://gameprogrammer.com/mailinglist.html
> >
> >
>=20
> ---------------------
> To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>=20
>
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- References:
- [gameprogrammer] OpenGL and mouse click location
- From: tobias . langner
- [gameprogrammer] Re: OpenGL and mouse click location
- From: Alan Wolfe
Other related posts:
- » [gameprogrammer] OpenGL and mouse click location
- » [gameprogrammer] OpenGL and mouse click location
- » [gameprogrammer] Re: OpenGL and mouse click location
- » [gameprogrammer] Re: OpenGL and mouse click location
- » [gameprogrammer] Re: OpenGL and mouse click location
- » [gameprogrammer] Re: OpenGL and mouse click location
- » [gameprogrammer] Re: OpenGL and mouse click location
- [gameprogrammer] OpenGL and mouse click location
- From: tobias . langner
- [gameprogrammer] Re: OpenGL and mouse click location
- From: Alan Wolfe