The strange thing with this is that the matrixtransfrom I get from casting to 
MatrixTransform*  is

  Matrix {
      1 0 0 0
      0 1 0 0
      0 0 1 0
      0 0 0 1
  }

not.

  Matrix {
      1 0 0 0
      0 1 0 0
      0 0 1 0
      30 0 0 1
  }

as I would have expected. I'm using the current OSG_OP_OT-1.0. 
Do I have to accumulate all parental MatrixTransforms to get the Matrix I'd 
expect from looking at the .osg file?

- servus, Tim -



> -----Ursprüngliche Nachricht-----
> Von: osg users <[email protected]>
> Gesendet: 02.06.06 09:14:37
> An: "osg users" <[email protected]>
> Betreff: Re: [osg-users] Changing the Position of an Object in the Scene


> 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/


______________________________________________________________________
XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club!            
Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to