On Feb 2, 2008 6:38 AM, Txema Vicente <[EMAIL PROTECTED]> wrote:
> 1.- Never move the camera, move the rest of the world. (Fog works! :)
What's the difference? ;)
> 2.- Save a copy of the projection and view matrix when projection is
> initially set.
I think you should strictly "move the world" only when you move the camera -
so when you apply the screen-to-world coordinate transformation, you don't
need to know at that point what the view matrix is. Otherwise, you'll end
up applying the view matrix transformation twice - which is wasteful.
> 3.- Save a copy of the model matrix before the target.blit
> 4.- For each target, project target position and then unproject mouse
> coords
> to
> get the coords in its plane.
>
Target of what? You'll have to explain this better to me (I'm a newbie
too). I'm not sure what you're trying to accomplish.
>
> Some code for point 4, may be it helps to another newbie.
>
> #class target
> def convert_3d(self,mouse_x,mouse_y):
> wx,wy,wz,sz = GLdouble(),GLdouble(),GLdouble(),GLdouble()
> gluProject(self.x, self.y, self.z,
> self.model_matrix, win.proj_matrix, win.view_matrix,wx, wy, sz)
> gluUnProject(mouse_x, mouse_y, sz,
> self.model_matrix, win.proj_matrix, win.view_matrix,wx, wy, wz)
> return wx.value,wy.value
>
> It works fine when traslating the world around the camera.
> Sure it is another typical newbie question, The only issue that I have is
> that when I rotate the world, the target coords are not correct.
>
Actually you need wz as well for the new world coordinates. Otherwise, if
you're not looking down the z-axis, the object will move towards and away
from the camera as you move the mouse. Also, I think your assumption in (2)
is wrong, which might be part of the problem. Hope this helps.
--
\\\\\/\"/\\\\\\\\\\\
\\\\/ // //\/\\\\\\\
\\\/ \\// /\ \/\\\\
\\/ /\/ / /\/ /\ \\\
\/ / /\/ /\ /\\\ \\
/ /\\\ /\\\ \\\\\/\
\/\\\\\/\\\\\/\\\\\\
d.p.s
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---