Thanx guys for your answers
I found a solution in tutorials like this
osg::Matrixd myCameraMatrix;
osg::Matrixd cameraRotation;
osg::Matrixd cameraTrans;
cameraRotation.makeRotate(
osg::DegreesToRadians(0.0), osg::Vec3(0,1,0), // roll
osg::DegreesToRadians(el), osg::Vec3(1,0,0) , // pitch
osg::DegreesToRadians( az), osg::Vec3(0,0,1) ); // heading
cameraTrans.makeTranslate( 1,5,1 );
myCameraMatrix = cameraRotation * cameraTrans;
osg::Matrixd i = myCameraMatrix.inverse(myCameraMatrix);
camera->setViewMatrix(i*osg::Matrix::rotate(-(osg::PI_2),1,0,0));
All works fine. Maybe it someone helps.
----- Original Message -----
From: "Robert Osfield" <[EMAIL PROTECTED]>
To: "osg users" <[email protected]>
Sent: Wednesday, May 16, 2007 4:56 PM
Subject: Re: [osg-users] Nub Q: how to move camera
Hi Roman,
Just set up the view matrix using osg::Matrix calls. Please note, HPR
can be done in many different ways depending on what convention you
use, so the OSG doesn't try to solve this can of worms, rather it
gives you all the tools to do what convention you want to adopt.
For instance the Matrix::rotate(..) method has one variation that
takes three rotation angles and three axis about which to rotate, you
can use this to do HPR with any convention you wish. You can write
you own convinience methods for doing this.
Once you have the matrix just pass this to the camera via setViewMatrix.
Robert.
On 5/16/07, Roman Grigoriev <[EMAIL PROTECTED]> wrote:
Hi Robert!
I still don't understand how to do this simple way
so I need thing like this camera-SetPositionAndHPR(pos,HPR);
could you plese write here simple code how to move camera manually to
desired position and rotate it to HPR angles
Thanx in advance
Roman
----- Original Message -----
From: "Robert Osfield" <[EMAIL PROTECTED]>
To: "osg users" <[email protected]>
Sent: Wednesday, May 16, 2007 3:27 PM
Subject: Re: [osg-users] Nub Q: how to move camera
> Hi Roman,
>
> There are lots of ways of controlling the camera, via one of the range
> of CameraMaipulators that you'll find in osgGA, or a custom
> manipulator likes these, or simple set your views master Camera's
> View and Projection matrices yourself.
>
> For tracking a node you might want to try the
> osgGA::NodeTrackerManipulator. See the osgplanets example.
>
> Robert.
>
> On 5/16/07, Roman Grigoriev <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hi guys!
>> Sorry for nub Q but what's the easiest way to move camera during
>> simulation?
>> I understand how to move objects using osg::PositionAttitudeTransform
>> but
>> I
>> can't attach camera node to PositionAttitudeTransform that controls
>> camera
>> node. so I have coordinates osg::Vec3 (1,2,3) and angles HPR
>> and need to place and rotate camera how can I do this?
>> Thanx in advance
>> Bye
>>
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://openscenegraph.net/mailman/listinfo/osg-users
>> http://www.openscenegraph.org/
>>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/