Hi Daniel,

Daniel Zuidinga wrote:
[snip]
> third one: here is the problem: the parent-core-type seems not to be 
> derived from OSG::Transform.
> 
> OSG::NodePtr C3DEngine::selectObject(int x, int y)
> {
> 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);
> mgr->setHeadlight(true);
> 
> OSG::NodePtr parent;
> parent = getParentNodeWithName(n,"OBJEKTTRANSFORM"); //gives a parent
> if(parent != OSG::NullFC)
> {
try this:

OSG::TransformPtr cTransform = OSG::TransformPtr::dcast(parent->getCore());

if(cTransform != OSG::NullFC)
{
OSG::Matrix m = cTransform->getMatrix();
m.setTranslate(10, 0, 0);
cTransform->setMatrix(m);
}
//...

> if(parent->getCore()->getType().isDerivedFrom( 
> OSG::Transform::getClassType())) //gives not the right type
> {
> OSG::TransformPtr cTransform = OSG::TransformPtr::dcast(parent->getCore());
> OSG::Matrix m = cTransform->getMatrix();
> m.setTranslate(10, 0, 0);
> cTransform->setMatrix(m);
> }
> }
> return n;
> }
> else
> {
> return OSG::NullFC;
> }
> 
> }
> 
> i can“t find my fault :-/

if the above works, there is a fault somewhere in the type info,
otherwise you probably don't have the right node.

        Hope it helps,
                Carsten

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to