Hello Keyan, On 05/31/2011 02:59 AM, Keyan wrote: > I currently have the problem of updating the position of node in my code. > this is what i do: > > Constructor: > { > _transform = OSG::Transform::create(); > > _simpleMaterial = OSG::SimpleMaterial::create(); > _material = OSG::MaterialGroup::create(); > _material->setMaterial(_simpleMaterial); > > _mNode = OSG::makeCoredNode<OSG::MaterialGroup>(&_material); > _tNode = OSG::makeCoredNode<OSG::Transform>(&_transform);
using makeCoredNode<T>(&core) creates a new node and new core of type T and stores a pointer to it in the argument. Since you already create the cores by hand you should use makeNodeFor(NodeCore* core) instead. Alternatively remove the lines that create _material and _transform and let makeCoredNode create them. > _node->addChild(_mNode); > _mNode->addChild(_tNode); > > _shape = OSG::makeBox(width, depth, height, res, res,res); > > _tNode->addChild(_shape); > > setPose(); > } > > setPose() > { > // caluclate q1 to q4 > _transform->editMatrix().setTranslate(pose.position.x, pose.position.z, > pose.position.y); > _transform->editMatrix().setRotate(OSG::Quaternion(q1, q2, q3, q4)); > } > > the first call of setPose in the constructor works, but calling it after that > again, does not result in a change of the position. i had it working at some > point, but after stripping my code, i can't get it back to work. hmm, I don't see anything wrong with the code you posted (unless it has to do with the double creation of some cores mentioned above). Are you sure pose and q1 to q4 are updated so you actually set new data when calling setPose? Cheers, Carsten ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users