Hi everyone ^^
I have a question.
I would like to update the position of an object with
PositionAttitudeTransform. I get different values that I then pass to the
matrix of my object. It works when the program is launched but after I
change the values they are well recovered but when I try to give them to
the matrix nothing happens. Do you have a solution??
the function of the callback for the update :
class DepthCullBack : public osg::NodeCallback{
public:
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) {
if (nv->getVisitorType() == osg::NodeVisitor::CULL_VISITOR ||
nv->getVisitorType() ==
osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN ||
nv->getVisitorType() == osg::NodeVisitor::TRAVERSE_ALL_CHILDREN
)
{
osgUtil::CullVisitor* cv =
static_cast<osgUtil::CullVisitor*>(nv);
// update position
osg::PositionAttitudeTransform* posM =
static_cast<osg::PositionAttitudeTransform*>(node);
posM->setPosition(osg::Vec3f(0.0f, 0.f,m_pPriGroup->m_dDepth));
}
traverse(node, nv);
}
private:
PRIGroup* m_pPriGroup;
};
the function update (loadIslands is the function who create my object) :
osg::Node* PRIGroup::updateScene(int nTypeClass,osg::Group* pGroup)
{
osg::ref_ptr<osg::Node> islandModel = new osg::Node;
FindNamedNodeVisitor fnnv("_oceanScene");
osg::ref_ptr<osg::PositionAttitudeTransform> positionMatrix = new
osg::PositionAttitudeTransform;
positionMatrix->setDataVariance(osg::Object::DYNAMIC);
switch (nTypeClass)
{
case CGeneric::SHAPE_SEA:
m_pMainScene->loadIslands("terrain_lispsm")->setCullCallback(new
DepthCullBack);
pGroup->accept(fnnv);
if (!fnnv._foundNodes.empty())
{
//pGroup->addChild(positionMatrix);
m_pMainScene->changeScene(CMainScene::CLEAR);
}
else
{
m_pMainScene->changeScene(CMainScene::DUSK);
}
return pGroup;
break;
default:
break;
}
}
thank you in advance ^^
--
You received this message because you are subscribed to the Google Groups
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/osg-users/CALpo-HGo5a%3DE7b4ZWXNaA8mZti5vW8BpDfXT_e6dbm947kZNTg%40mail.gmail.com.