Hello Johannes,
On Mon, 2007-08-27 at 14:31 +0200, Johannes Brunen wrote:
> Hi,
>
> Currently I'm getting comfortable with the OpenSG traversal
> infrastructure.
> As a first example I tried the new intersection action. Howerver, I got
> different
> result when using the IntersectAction. Actually, I didn't get
> any intersection with the new IntersectActor class.
well, the NewAction stuff was an experiment to reimplement the traversal
infrastructure, but instead of making things easier it brought a whole
new wave of complexity and thus is now bitrotting in experimental.
So I suggest you just use the normal IntersectAction, which usually
works ;)
> Below my simple example program:
>
> using namespace osg;
> Line line = viewer->at(0)->calcViewRay(x, y);
>
> NodePtr root = viewer->at(0)->getRoot();
> NodePtr result1 = NullFC;
> NodePtr result2 = NullFC;
>
> {
> IntersectActor* actor = IntersectActor::create();
> DepthFirstAction* action =
> DepthFirstAction::create();
>
> action->addActor(actor);
> actor->setRay(line);
I suspect an
actor->setMaxDistance(10000.0f);
might help, the default value for max distance is probably not correct.
Hope it helps,
Carsten
> action->apply(root);
>
> if (actor->getHit()) {
> result2 = actor->getHitObject()->getParent();
> }
>
> delete action;
> delete actor;
> }
>
> {
> IntersectAction* action = IntersectAction::create();
> action->setLine(line);
> action->apply(root);
>
> if (action->didHit()) {
> result1 = action->getHitObject();
> }
> delete action;
> }
>
> assert(result1 == result2);
>
> Any mistakes I did in my code?
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users