As Robert says, this list isn't for writing your program for you. This is a general 3D maths question, and not OSG specific. But as I've got a few minutes, I'll explain. You have a model/view/projection matrix (either all separately or as one matrix). This converts a point from from world-space to screen-space. Your mouse cursor is in screen-space, and you want to convert it to world-space. This sounds like the operation is inverted, and this gives you a clue as to what you should use. Most matrices used in 3D are invertable, and OSG has a function to do just that. So go ahead and invert your MVP matrix then transform your mouse pointer position by that matrix, and Bob's your whatsit, you have a position in world-space. From here, it's even easier; you take your camera position in world-space, and make a vector pointing from that to your mouse pointer's world-space position, and you have your ray. I've deliberately left out a couple of things you'll need to know, because as a university student, you should be finding these things out for yourself. To be perfectly honest, this is really basic 3D maths, and you shouldn't need to ask these sorts of questions here. IIRC you're writing this for a university project, in which case you should be asking your tutor, and going to the university library and looking for any of a number of books on 3D maths. Heck, you can even get the OpenGL 1.1 guide online now, and although the OpenGL is slightly out of date (but still valid), the maths and basic 3D principles will remain the same for ever (in this universe at least).
John Donovan Sony Computer Entertainment Europe http://www.scee.com [EMAIL PROTECTED] wrote on 06/12/2006 15:19:58: > how I get such ray from the camera to the mouse cursor? > what O do is to use the function "computeNearFarPoints" and get the > 2 point,and get the intersection of the segment that the points > create withe the plane... but I don't have osgProducer::Viewer so I > can't use this function... > > thanks > NB ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify [EMAIL PROTECTED] This footnote also confirms that this email message has been checked for all known viruses. ********************************************************************** Sony Computer Entertainment Europe _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
