Hi Tim,
From the intersection traversal you should get a Hit with the NodePath
on it, just walk through this NodePath from back to front testing for
Node* which can be dynamically cast to MatrixTransform and then just
multiple its matrix by a translation matrix i.e.
matrixtransform = dynamic_cast<MatrixTransform*>(node);
if (matrixtransform)
{
matrixtransform->setMatrix(osg::Martix::translate(x,y,z)*
matrixtransform->getMatrix());
}
On 6/1/06, tim hartter <[EMAIL PROTECTED]> wrote:
Hi,
I'd like to change the Position of an Object in my Scene after picking
it by mouse picking.
I already have a ref_ptr, call it m_Node, pointing to the Object I want
to move, but I don't know how to apply the changes correctly. I don't
want to insert another MatrixTransform, I'd like to modify the original
one to translate the Object to the new position.
In my .osg File it looks something like this:
MatrixTransform {
DataVariance STATIC
name "Moon"
...
Matrix {
1 0 0 0
0 1 0 0
0 0 1 0
30 0 0 1
}
num_children 1
Geode {......}
}
and I want to apply the changes so that I have
...
Matrix {
1 0 0 0
0 1 0 0
0 0 1 0
30+x 0+y 0+z 1
}
...
in the .osg File after saving it back. Vec3(x,y,z) is th amount by which
I'd like to move the object.
Thanks for any help
- Tim -
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/