thanks a lot Nick let me try this way. thanks

On Thu, May 9, 2013 at 7:18 PM, Trajce Nikolov NICK <
trajce.nikolov.n...@gmail.com> wrote:

> Hi Sujan,
>
> here is how I would do it:
>
> //Let load the model:
> osg::Node* model = osgDB:: readFile(....);
>
> // Create MatrixTransform on top of it
> osg::MatrixTransform* mxt = new osg::MatrixTransform;
>
> // create the scene
> mxt->addChild(model);
> viewer->setSceneData(mxt);
>
>
> Now, having it like this, by modifying the matrix in the MatrixTransofrm,
> you can move the loaded object in the scene as you are doing with
> onPan(double dx, double dy), and don;t touch the view matrix
>
> something like:
> void onPan(double dx, double dy)
> {
>    osg::MatrixTransform* mxt =
> dynamic_cast<osg::MatrixTransform*>(viewer->getSceneData());
>    mxt->setMatrix(osg::Matrix::translate(1000+dx, 0, 0))
> }
>
> you get the idea? Hope it helps
>
> Nick
>
>
> On Thu, May 9, 2013 at 3:15 PM, Sujan Dasmahapatra <
> sujan.dasmahapa...@gmail.com> wrote:
>
>> Nick I want to move the object a simple pan with mouse.
>>
>>
>> On Thu, May 9, 2013 at 5:32 PM, Trajce Nikolov NICK <
>> trajce.nikolov.n...@gmail.com> wrote:
>>
>>> Hi Sujan,
>>>
>>> what are you trying to do with your 'pan'? To move an object, or to move
>>> the camera (view) ?
>>>
>>> Nick
>>>
>>>
>>> On Thu, May 9, 2013 at 1:03 PM, Sujan Dasmahapatra <
>>> sujan.dasmahapa...@gmail.com> wrote:
>>>
>>>> I am trying to pan my model pls check the code snippet below.
>>>> viewer = composite view.
>>>> getTransform() will return a osg::PositionAttitudeTransform list.
>>>>
>>>> But my object is moving in z direction as well inwards outwards. What
>>>> am I doing wrong please help. Thanks Sujan
>>>>  void CSGraphicsView::pan( float dx, float dy )
>>>> {
>>>> osg::Vec3 transform =
>>>> viewer->getTransform()->getTrans().first()->getPosition();
>>>>  transform += osg::Vec3(dx,dy,0.0f);
>>>> viewer->getTransform()->getTrans().first()->setPosition(transform);
>>>> }
>>>>
>>>> --
>>>> Thanks & Regards
>>>> Sujan
>>>>
>>>> _______________________________________________
>>>> osg-users mailing list
>>>> osg-users@lists.openscenegraph.org
>>>>
>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>>
>>>>
>>>
>>>
>>> --
>>> trajce nikolov nick
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users@lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>>
>>
>>
>> --
>> Thanks & Regards
>> Sujan
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users@lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>>
>
>
> --
> trajce nikolov nick
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Thanks & Regards
Sujan
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to