[HOpenGL] Hitdetection
Patrick Scheibe
mai99dnn at studserv.uni-leipzig.de
Tue Feb 15 14:55:28 EST 2005
Hi,
A picture of my quadgame is atached.
I need a kind of hitdetection for knowing where the player want's to set the
next stone. I copied for testing the code of Sven but it doesn't work in the
right way...
As shown in the PickDepth or PickSquare example I added some hitrecord names
to each grey square on the picture. When you click on the window, the same
code like in the examples is executed. Except of the ortho2D call after the
pickMatrix... I do not exactly know, what I have to fill there..
I tried it in the following way:
justifyCamera :: GamePackage -> IO ()
justifyCamera gp = do
let C {cp = camPers, cla=camLook} = gpGetCam gp
(a,r,n,f) = camPers
(e,c,u) = camLook
-- matrixMode $= Projection
-- loadIdentity
GLU.perspective a r n f
-- matrixMode $= Modelview 0
-- loadIdentity
GLU.lookAt e c u
I just commented out the change of the matrixMode. But that isn't right..
I have hits anywhere in the space but not on the planes :(
Any good ideas? Or is there a good tutorial except of the gluSpec? My problem
is that I don't understand how it should work in all details.
Best regards
Patrick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quad.jpg
Type: image/jpeg
Size: 57520 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/hopengl/attachments/20050215/819bdcf8/quad-0001.jpg
More information about the HOpenGL
mailing list