Hi. Robert.
Thanks for ur respond, I have read the code osgAnimation. I used some
confused word to describe my problem. ( :( bad English, my native laguage is
Chinese ).
What i want to know is that how the camera can go along its latest
way(or path),
For example, I drag the focus of camera ( trackball-manipulator ) from
left to right on a window, then the camera should go around the trackball
of the scene from a position to anothion. when I release the button, the
camera can continue along its latest way( or path ) at a speed. when i drag
from right to left, the camera go reversely and can go along with its new
path.
I failed to enable the camera continue along its latest way. when i
release the button, the scene ceased, too.
Thanks.
xiaodong
On Nov 22, 2007 5:42 PM, Robert Osfield <[EMAIL PROTECTED]> wrote:
> Hi Xiaodong,
>
> The TrackballManipulator is just for user interaction with the camera
> position, its does support throwing which is activated by the user
> releasing a mouse button while still moving the mouse. It sounds like
> this is not what you want though.
>
> To general rotate objects in the scene the way to do is to place a
> Transform node of some type (i.e.
> osg::MatrixTransform/PositionAttitudeTransform) and then attached an
> osg::AnimationPathCallback to it, or to attach a
> osgUtil::TransformCallback the later is deprecated though. With an
> AnimationPath you can define any combination of scaling, rotation and
> translation. Have a look at the osganimation example.
>
> Robert.
>
> On Nov 22, 2007 9:34 AM, Wu Xiaodong <[EMAIL PROTECTED]> wrote:
> >
> > Hi, Everyone:
> >
> > I am a total begginer user of OSG for 3 days.
> >
> > How can i enable the auto-rotate effect on a TrackballManipulator?
> >
> > I have attached a osgViewer::viewer to a window on Win32.(
> windiow+MFC
> > ) by following code.
> >
> > viewer = new osgViewer::Viewer;
> > osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
> > osg::GraphicsContext::Traits;
> > traits->x = 0;
> > traits->y = 0;
> > traits->width = rc.Width();
> > traits->height = rc.Height();
> > .........
> >
> /////////////////////////////////////////////////////////////////////////////////
> > osg::ref_ptr<osgViewer::GraphicsWindowWin32::WindowData> wdata = new
> > osgViewer::GraphicsWindowWin32::WindowData( GetSafeHwnd() );
> > traits->inheritedWindowData = wdata.get();
> > osg::ref_ptr<osg::GraphicsContext> gc =
> > osg::GraphicsContext::createGraphicsContext( traits.get());
> > if ( gc.valid() ) {
> > viewer->getCamera()->setGraphicsContext( gc.get());
> > viewer->getCamera()->setViewport(new osg::Viewport(0,0, traits->width,
> > traits->height));
> > }
> > ............................................................
> >
> >
> ///////////////////////////////////////////////////////////////////////////////////////////////
> > viewer->setSceneData( createGeode().get() );
> > viewer->setCameraManipulator(new osgGA::TrackballManipulator);
> > viewer->addEventHandler(new osgViewer::StatsHandler);
> > viewer->realize();
> >
> > //========
> > but I cannot enable the Node "viewer" to auto-rotate just as the
> > demos in the tutorial on site of "www.openscenegraph.org"on the events
> of
> > mouseButtonPress(x,y,1) or mouseButtonPress(x,y,3) and
> > mouseButtonRelease(x,y,1) or mouseButtonRelease(x,y,3).
> >
> > what's the problem in the code? Thanks!
> >
> > xiaodong
> >
> >
> >
> >
> >
> >
> > --
> > xiaodong Wu.
> >
> > _______________________________________________
> > 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
>
--
吴晓东
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org