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

Reply via email to