Hi Gopal,

Sometimes canned models pivotpoint set to undesired position which not
suitable your desired pivotpoint position. So to solve this problem you have
two chance, you can open your model by 3D model programs and after you
configure pivotpoint you export it again and use new model or set your
desired pivot position to your PAT node by setPivotPoint. Its usage so
simple. You choose your desired global point to make pivot your PAT node.
For example;

osg::Node* createRoom(osg::Node* loadedModel) // From osgLight example
{
    // default scale for this model.
    osg::BoundingSphere bs(osg::Vec3(0.0f,0.0f,0.0f),1.0f);

    osg::Group* root = new osg::Group;

    if (loadedModel)
    {
        const osg::BoundingSphere& loaded_bs = loadedModel->getBound();

        osg::PositionAttitudeTransform* pat = new
osg::PositionAttitudeTransform();
        pat->setPivotPoint(loaded_bs.center());

As you can see from attached code we get the models boundingSphere's center
and make it pivotPoint. After this initialization your model will be rotated
around this point by setAttitude command.

You can look at osgLight, osgLauncher and osgLogo too.
HTH.
Regards.

Ümit Uzun


2009/10/2 gopal goenka <gopal.goe...@hed.ltindia.com>

> Hi,
>
> I am using OSG-2.8.0
> i have read a .3DS file with a certain origin.
> now i am trying to rotate the object in the file about a point other than
> its origin in that file .
> for that i have used PAT.............
>
> i have tried to use setPivotPoint but could not understand its working
> can any body suggest the way to use it . if possible with an
> example...........
>
> Thank you!
>
> Cheers,
> gopal :P
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=17783#17783
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to