Hi JP,
I'd like to improve on the current set of osgGA::MatrixManipulator as
they arn't that easy to work with. There are old old classes that are
in dear need of a refactor, and I'll get round this to eventually.
What might be better is to create a new set of matrix manipulators
that are more flexible and powerful and just deprecate the old ones
rather than refactoring them.
This type of work will be post 1.3 though, have plenty of other things
to tackle in the mean time.
Robert.
On 12/22/06, J.P. Delport <[EMAIL PROTECTED]> wrote:
Hi Frédéric,
for me it was much more intuitive to work with the internal variables
_distance, _rotation and _center of the MatrixManipulator class (from
which Trackball is derived). I added functions to my own base class to
get and set these values directly (just make a copy of OSG's one and
stick in two new methods, mine is below). You can see how the values are
used by looking at the getMatrix() call of the base class.
I usually visualise it as follows:
_center sets the focus position
_rotation starts from a default camera rotation and rotates about the
focus position
_distance moves the camera away from the focus position in the direction
set by the rotation
For me the problem with only being able to set the matrices was also
what you experienced, the matrix can contain only one position and
rotation, so one sets the camera position and rotation, but not the
focus position about which the manipulator's rotation happens. Using the
_distance, _rotation and _center values, one can jump between different
manipulators easily while keeping the focus position where one wants it.
hope this helps.
regards
jp
---------8<------------
/** get by distance, rotation, center. */
virtual void getDRC(double& distance, osg::Quat& rotation, osg::Vec3d&
center) {
distance = _distance;
rotation = _rotation;
center = _center;
}
/** set by distance, rotation, center. This keeps the focus point
correct. */
virtual void setByDRC(double distance, osg::Quat rotation, osg::Vec3d
center) {
_distance = distance;
_rotation = rotation;
_center = center;
_thrown = false;
flushMouseEventStack();
}
Frédéric SPEISSER wrote:
> Hello all,
>
>
> I'm actually working (trying to work...) with
> /osgGa::TrackballManipulator/ in order to manipulate a camera around a
> loaded object.
> I use a perspective projection matrix and a modelview matrix, but when I
> try to rotate my camera, it seems to rotate around the center of the
> scene and not around the object...
> I set my modelview matrix through the method /setByMatrix/ from the
> /osgGA::TrackballManipulator/ class, this seems to alter the
> initialisation of the trackball : when i don't set a modelview matrix,
> the trackball rotation behaves in a normal way.
> How can I set a modelview matrix to the trackball in a "proper way"
> that's to say : have a defined view of my object at the start of the
> rendering and be able to use a trackball on it ?
> Do I have to use the osgGA::MatrixManipulator::setHomePosition method ?
> If yes, how ? (I've already tested it..)
> I ask this question a few days ago, but i keep not understanding how to
> solve this problem.
> Could someone help me or give me a clue please ?
> Thank you,
>
> Frédéric
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
>
--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
[EMAIL PROTECTED]
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their
support.
_______________________________________________
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/