Hello,Please find the equations down there:XYZ are 3D coords of a point IN CAMERA REF
xy are screen coords as per the near clipping plane.
WH are width and height of the screen
then we have:
X=Z*tan(fov/2)*(2*x/W-1);//1
Y=Z*tan(fov/2)*(H-2*y)/W;//2You need the object Z (picked position) and transform it into the camera ref.Then you position the object on a plane perpendicular to the camera dir at Z,using X,Y.Best regards,Christian Garnier.
-----Message d'origine-----
De : owner-virtools-user-group@lists.theswapmeet.com [mailto:owner-virtools-user-group@lists.theswapmeet.com]De la part de Kam Memarzia
Envoyé : mardi 9 avril 2002 10:18
À : 'Virtools Mailing List'
Objet : [Virtools] Moving Objects using the mouse.Greetings,
I'd like to replicate the Move function in Dev within a cmo using the mouse.
So that once the object is clicked on, it can be dragged around in a plane (say X,Z) - whilst staying underneath the mouse.
Its translating the screen co-ordinates into world space I think.
Any clues, thoughts, equations or solutions would be most appriciated.
Thanks
Kam Memarzia