Article View: free.pl.comp.games.development
Article #299Re: Interakcja w grze typu rpg/rts
From: igloo
Date: Sun, 18 Jan 2004 14:28
Date: Sun, 18 Jan 2004 14:28
27 lines
1860 bytes
1860 bytes
deely napisa�: > Mam pytanko, > czego uzywacie w grach typu rpg,rts do powiedzmy zaznaczania > jednostek, budynkow, etc. Po prostu do pobierania elementow ktore sa > "pod" kursorem myszy??? Bufora selekcji, czy moze przeliczacie > wspolrzedne 2d->3d ??? (oczywiscie chodzi mi o gre w 3 wymiarach!) > BTW: pisze pod OpenGL. do tego s�u�y gluUnProject. GLdouble x, y; //wsp�rz�dne myszy GLdouble nx, ny, nz, fx, fy, fz; GLdouble m[16], p[16]; GLint vp[4]; glGetIntegerv(GL_VIEWPORT, &vp); glGetDoublev(GL_MODELVIEW_MATRIX, &m); glGetDoublev(GL_PROJECTION_MATRIX, &p); gluUnProject(x,y,0.,m,p,vp,&nx,&ny,&nz); gluUnProject(x,y,1.,m,p,vp,&fx,&fy,&fz); (nx,ny,nz) i (fx,fy,fz) to punkty prze kt�re przechodzi prosta. Dalej to ju� tylko sprawdzi� kolizj� z obiektami na scenie i wybra� najbli�szy. -- Wojtek
Technical Details
Message-ID:
<bue56m$4sh$1@nemesis.news.tpi.pl>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mailReferences:
<8uf500drqo6cmk8sqm0naoeeofku6o60qf@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Language: POLISH,Latin2 X-Google-Thread: 1162ab,c1bd2299ba3be233 X-Google-Attributes: gid1162ab,public X-Google-ArrivalTime: 2004-01-18 06:27:00 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail From: igloo <hateSpam@antarctica.pl> Newsgroups: free.pl.comp.games.development Subject: Re: Interakcja w grze typu rpg/rts Date: Sun, 18 Jan 2004 14:28:48 +0000 (UTC) Organization: tp.internet - http://www.tpi.pl/ Lines: 27 Message-ID: <bue56m$4sh$1@nemesis.news.tpi.pl> References: <8uf500drqo6cmk8sqm0naoeeofku6o60qf@4ax.com> NNTP-Posting-Host: pe68.kielce.cvx.ppp.tpnet.pl Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit X-Trace: nemesis.news.tpi.pl 1074436128 5009 217.99.220.68 (18 Jan 2004 14:28:48 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Sun, 18 Jan 2004 14:28:48 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux)