osgUtil::SceneView::projectWindowXYIntoObject(int x,int y,osg::Vec3& near_point,osg::Vec3& far_point)
Gives you the line segment in the view frustrum under the (x,y) screen coordinates provided. osgProducer::Viewer::computeIntersections(...) likely does it all for you :-) Don On Fri, 2006-10-20 at 15:21 +0200, Ivan Bolčina wrote: > Yes. And how to do it? I figure it has something to do with inverting > perspective/view matrix, but how? > > 2006/10/20, Andreas Goebel <[EMAIL PROTECTED]>: > Ivan Bolčina schrieb: > > Ok. Yes I will take a look at osgPick. Basically i need a > vector where > > mouse is pointing so that the bullets are assigned that > vector for > > movement. > Hi, > > while osgPick will help you to find a vector (or rather a > line-segment) > that is exactly perpendicular to the screen and starting at > the point > where the mouse is currently, I do not think that this will be > the > correct vector for your bullets. If you do this, your bullets > will fly > like this: > > ||||||||||||||||||||||||| (Bullets) > ------------- (Screen) > > Your gun has a fixed length, and the vector of your bullets is > given by > the direction of your gun. If the gun is fixed somewhere, the > points the > other end of the gun can reach lie on a sphere. So you might > be better > of by using the mouse-coordinates to compute some spherical > coordinates > for your gun. > > \ | / (Bullets) > ----------------------- (Screen) > > Regards, > > Andreas > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ > > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ -- "A government that is big enough to give you all you want is big enough to take it all away." -- Barry Goldwater +---------------+ | Don Tidrow | | Vis-Sim geek | +---------------+
signature.asc
Description: This is a digitally signed message part
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
