CG wrote:

> My model's axes are aligned to the world coordinate system. What I
> need is the body/local coordinate system of the plane to rotate the
> plane correctly in each tick. I've attached a screen shot which shows
> the wrong rotation using world coordinate system (the plane is rotated
> 90 degrees to the right and pitch up 90 degrees, the plane's nose
> should point right and not up in the sky). Thanks.

If you know how your model is oriented w.r.t. world coordinates then you
also know which rotations to apply, and in which order, to get what you
want.
Remember that OSG uses post-multiplication order, so if you want a quat
that rotates first around X, then around Y and then around Z you need to do
Quat q_total(Quat(x_angle, X_AXIS) * Quat(y_angle, Y_AXIS) *
Quat(z_angle, Z_AXIS))

Paul

>
> Regards,
> Cg
>
> ------------------------------------------------------------------------
>
> > Date: Thu, 5 Jun 2008 10:01:00 +0200
> > From: [EMAIL PROTECTED]
> > To: [email protected]
> > Subject: Re: [osg-users] finding normal of models
> >
> > Hi,
> >
> > CG wrote:
> >
> > > How do I retrieve the body axis of the model?
> >
> > Not sure what you mean by "body axis", but what you could do is load
> > both your model and the axes.osg sample dataset. Simply use
> > osgviewer <your-model-file> axes.osg
> >
> > The axes object will show the world coordinate system and should help
> > you figure out how to rotate your plane, as it will show how your
> > _untransformed_ plane is oriented compared to the world coordinate
> system.
> >
> > The axes object is probably quite small compared to your plane object
> > (depending on the units used for the plane, of course) and might even be
> > inside it. You can switch to wireframe mode in that case with "w" to
> > perhaps be able to pinpoint the axes.
> >
> > Paul
> >
> > > I'm thinking of retrieving the body axis of the model and use it to
> > > rotate the model by
> > >
> > > osg::Quat rotation(osg::Quat(yaw, body_axis_z)*osg::Quat(roll,
> > > body_axis_y)*osg::Quat(pitch, body_axis_x));
> > >
> > > pat->setAttitude(rotation);
> > >
> > >
> > > instead of
> > >
> > > osg::Quat rotation(osg::Quat(yaw, osg::Vec3(0,0,1))*osg::Quat(roll,
> > > osg::Vec3(0,1,0))*osg::Quat(pitch, osg:Vec3(1,0,0)));
> > >
> > > pat->setAttitude(rotation);
> > >
> > > so that the aircraft will be rotated correctly. Thanks.
> > >
> > > Regards,
> > > Cg
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > > From: [EMAIL PROTECTED]
> > > To: [EMAIL PROTECTED] openscenegraph.org
> > > Date: Wed, 4 Jun 2008 18:04:43 +0100
> > > Subject: Re: [osg-users] finding normal of models
> > >
> > > HI
> > > A loaded model/node really does not in itself have a normal, its
> > > surfaces/tris etc that make up a model will have (or should have )
> > > normal's. So sorry its not possible to retrieve a nodes normal's.
> > > In all my years of being involved with vis-sim, you really have to
> > > know before hand how your models are orientated, scaled etc ,
> > > typically your modelling specs should state what is north, what is
> > > up, what units are used etc, then these need to be enforced on and
> > > followed by the content creators.
> > > Personally I don't know a way of figuring out, in arbitary models
> > > what are north, up, right etc.. you have a chance with
> > > scale/units. you have to know the orientation details of the
> models*> > Sorry not much help really
> > >
> > > __________________________________________________________
> > > /Gordon Tomlinson /
> > >
> > > Email : /[EMAIL PROTECTED]/
> > > Website : /www.vis-sim.com www.gordontomlinson.com/
> > >
> > > __________________________________________________________
> > >
> > > "Self defence is not a function of learning tricks
> > > but is a function of how quickly and intensely one
> > > can arouse one's instinct for survival"
> > > -*/Master Tambo Tetsura/*
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > > *From:* [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] *On Behalf Of *CG
> > > *Sent:* 04 June 2008 17:27
> > > *To:* OpenSceneGraph Users
> > > *Subject:* [osg-users] finding nor mal of models
> > >
> > > Hi,
> > >
> > > Is it possible to retrieve the Normal of a loaded node (i.e. an
> > > aircraft in openflt format)? I need to find out the normal to
> > > compute the forward and right axis to construct my rotation matrix
> > > to rotate the aircraft correctly in every tick. Right now, when I
> > > roll my aircraft to 90 degrees follow by a 90 degrees pitch, the
> > > aircraft instead of banking to the right, it rolls 90 degrees to
> > > the right and pitches up 90 degrees (as the rotation axis is
> > > unchanged). I'm using positiontransformattitude node for the
> > > setting of Attitude. Thanks.
> > >
> > > Regards,
> > > Cg
> > >
> > >
> ------------------------------------------------------------------------
> > > Always-on security tools provide safer ways to connect and share
> > > anywhere. Find out more. Windows L ive
> > > <http://get.live.com/familysafety/overview>
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > > Share your beautiful moments with Photo Gallery. Windows Live Photo
> > > Gallery <http://get.live.com/photogallery/overview>
> > >
> >
> >------------------------------------------------------------------------
> > >
> > >_______________________________________________
> > >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
>
>
> *
> ------------------------------------------------------------------------
> *Always-on security tools provide safer ways to conn ect and share
> anywhere. Find out more. Windows Live
> <http://get.live.com/familysafety/overview>*
>
>*
>*
>------------------------------------------------------------------------
>*
>_______________________________________________
>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