Here's my code snippet...

...
while (!viewer->done())
{
        if (model_update_needed)
                mt->setMatrix(osg::Matrix::rotate(osg::inDegrees(heading),
0.0, 0.0, 1.0) *
                                  osg::Matrix::translate(modelx, modely,
modelz));
        ...
        viewer->frame();
}

In the code above, if I have just a translate, the model moves just fine as
position changes. Once I multiply by a rotation for a heading change, the
model disappears.

-Shayne

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gordon
Tomlinson
Sent: Monday, August 04, 2008 5:18 PM
To: 'OpenSceneGraph Users'
Subject: Re: [osg-users] moving models...

Providing the code you use to set the translation and rotations may help
folks see what may be wrong



__________________________________________________________
Gordon Tomlinson 

[EMAIL PROTECTED]
IM: [EMAIL PROTECTED]
www.vis-sim.com www.gordontomlinson.com 
__________________________________________________________

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tueller,
Shayne R Civ USAF AFMC 519 SMXS/MXDEC
Sent: Monday, August 04, 2008 7:13 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] moving models...

Ok, I updated the transform node as given below for position changes and
this seems to work. However, when I add an orientation update (i.e. multiply
the translation by a rotation) my model disappears completely. Any idea on
what's going on with that? 

Thanks,
-Shayne

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of su hu
Sent: Saturday, August 02, 2008 3:19 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] moving models...

Shayne,
 
In my application, a global buffer is used to input data to osg thread from
other thread.
 
I used the method as same as Todd told you. "setMatrix()" is used to update
the matrix of that MatrixTransform node.
 
 
...
 
osg::ref_ptr<osg::group> root;
osg::ref_ptr<osg::MatrixTransform> MotionMatrix;
osg::ref_ptr<osg::node> MotionModelFile;                   //your motion
model
 
...
root->addchild(MotionMatrix);
 
MotionMatrix->addchild(MotionModelFile);
 
...

 while((!Viewer.done)
 {
...
 
if(Update is Needed)
//position is changed or other
     MotionMatrix->->setMatrix(osg::Matrix::translate(Pos));  //your
position data 
 
...
   Viewer.frame();
 
...
}
 
 
 
 
su hu

 
2008/8/2, Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC
<[EMAIL PROTECTED]>: 

        This is probably a silly and simple question, but does anyone have
an example of how to move a model explicitly without using a canned
animation? Most of the examples I've seen, update the position in an
animation using UpdateCallback. 

         

        I have a position update coming from another process outside the
scenegraph that I need to feed into the model to update its position. Do I
need to use an UpdateCallback or a NodeVisitor approach?

         

        Any help would be most appreciated.

         

        Thanks,

        -Shayne


        _______________________________________________
        osg-users mailing list
        [email protected]
        
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
        
        
        



_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to