Hello NG,

i add a vrml-object to my Scenegraph and the intersection action works 
fine. But as soon as i move the object from it´s position the 
intersection doesn´t work any more if the object is to far away from 
it´s origin. If i only move or rotate it a bit, it still works.

Can anybody help me?


This is my code:

The Intersection Code:
OSG::Line ray = mgr->calcViewRay(x, y);
OSG::IntersectAction *iAct = OSG::IntersectAction::create();
iAct->setLine(ray);
iAct->apply(mgr->getRoot());

if (iAct->didHit())
{
OSG::NodePtr n = iAct->getHitObject();
currentObject = n;
mgr->setHighlight(n);
...
}


An the setting of the object translation(which works at least visually):
OSG::Matrix m = currentTransform->getMatrix();
OSG::Matrix tmp;
m.setIdentity();
tmp.setIdentity();

tmp.setTranslate(posX, posY, posZ);
m.mult(tmp);

OSG::Quaternion qX(OSG::Vec3f(1,0,0), rotX/180.0f*PI);
OSG::Quaternion qY(OSG::Vec3f(0,1,0), rotY/180.0f*PI);
OSG::Quaternion qZ(OSG::Vec3f(0,0,1), rotZ/180.0f*PI);
qX.mult(qY);
qX.mult(qZ);
tmp.setRotate(qX);
m.mult(tmp);
tmp.setScale(scaleX, scaleY, scaleZ);
m.mult(tmp);

currentTransform->setMatrix(m);
mgr->redraw();

Thanks
Daniel






-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to