Dear Allan,
> Do you define your own camera at some point? If you do something like:
Yes!
> pwin = PassiveWindow::create();
> pwin->init();
>
> // create the SimpleSceneManager helper mgr = new SimpleSceneManager;
>
> // create the window and initial camera/viewport
> mgr->setWindow(pwin );
> // tell the manager what to manage
> mgr->setRoot (scene);
>
> //Create a camera, Could be any type.
> cam = MatrixCamera::create();
> beginEditCP(cam);
> //... whatever that sets up the projection matrix EndEditCP(cam);
>
> // now change the camera
> ViewportPtr vp = pwin->getPort(0);
>
> beginEditCP(vp);
> vp->setCamera(cam);
> endEditCP(vp);
yes yes yes!
> And later in the picking code use, as you describe:
>
> IntersectAction *iAct = IntersectAction::create();
> iAct->setLine(mgr->calcViewRay( x, y ));
yes yes yes!
> This will be where the error is. The reason is that the
> SimpleSceneManager uses it's internal (perspective) camera for the
> calcViewRay. It does NOT know about the camera you have set yourself.
> Instead, you must do:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!
> Line l;
> pwin->getPort(0)->getCamera()->calcViewRay(l, x,y, *pwin->getPort(0));
>
> IntersectAction *act = IntersectAction::create();
> act->setLine(l);
> act->apply(scene);
Allan, thank you so much, that was exactly the problem, picking now works
like a charm! How comes that the SimpleSceneManager does not get informed
about the new camera?
Mange tak min ven!
Toni
P.S.: Dirk: The solution works with the 1.6 release...
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users