Dear all,

I'm trying to obtain the model matrix, the view matrix, the projection matrix 
and the window matrix. I used  the following piece of code in my pick event 
handler.

protected unsafe bool pick(OsgGA.GUIEventAdapter ea, OsgViewer.Viewer viewer)
{
    ......
    picker = new 
OsgUtil.LineSegmentIntersector(OsgUtil.Intersector.CoordinateFrame.PROJECTION,
                    ea.getXnormalized(), ea.getYnormalized());
    OsgUtil.IntersectionVisitor iv = new OsgUtil.IntersectionVisitor(picker);
    viewer.getCamera().accept(iv);

    Osg.Matrix VPW = new Matrix();
    if (iv.getWindowMatrix()!=null)
                {
                    Osg.Matrix mm = new Osg.Matrix(iv.getWindowMatrix().ptr()); 
                   
                    VPW.preMult(mm);
                }
    if (iv.getProjectionMatrix() != null)
                {
                    Osg.Matrix mm = new 
Osg.Matrix(iv.getProjectionMatrix().ptr());
                    VPW.preMult(mm);
                }
    if (iv.getViewMatrix() != null)
                {
                    Osg.Matrix mm = new Osg.Matrix(iv.getViewMatrix().ptr());
                    VPW.preMult(mm);
                }
    if (iv.getModelMatrix() != null)
                {
                    Osg.Matrix mm = new Osg.Matrix(iv.getModelMatrix().ptr());
                    VPW.preMult(mm);
                }
......
}

But the iv object could never return any matrix and all the Boolean expression 
in the if statement always equal to false.

I'm wondering what is wrong here. Is there any thing else that I need to do 
before I can obtain the matrices?

Any help is appreciated!

Regards,

Ke Li



_________________________________________________________________
Connect and share in new ways with Windows Live.
http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012008
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to