Re: [osg-users] Quaternion problem

2009-03-17 Thread J.P. Delport
Hi, yes, try to store your angle manually. We have something similar, an object has yaw, pitch & roll, but we modify it depending on where on the globe it is: lori = quat made from object r,p,y // Make offset quat from position on globe qoff = mScenario->getOrientationOffsetFromLLH(i_dLat, i

Re: [osg-users] Quaternion problem

2009-03-17 Thread Antonin Linares
Hi Steven, Maybe, i'm not clear, I want to keep the current yaw angle, and change pitch and roll by the terrain normal. So i use getRotate to find my previous yaw angle, like you Steven, i thinks thats not the solution. Maybe i need to store this yaw angle in custom data. Hi JP i use osg 2.8

Re: [osg-users] Quaternion problem

2009-03-17 Thread J.P. Delport
Hi, I also vaguely remember someone having a question about the getRotate. Go check in the source if it returns an angle and vector or if you actually pass _in_ a vector/axis. jp Steven Saunderson wrote: Hi Antonin, I may be getting way out of my depth here but when I saw your problem this

Re: [osg-users] Quaternion problem

2009-03-17 Thread Steven Saunderson
Hi Antonin, I may be getting way out of my depth here but when I saw your problem this morning it looked very similar to a problem I had just recently. Looking at your original post : Antonin Linares wrote: > > //get height and normal under the tank > osg::Vec3f pos = > lsi->getFirstInterse

Re: [osg-users] Quaternion problem

2009-03-17 Thread Antonin Linares
Thanks Steven Yes i have, but i get something very strange (rot * correction) == (correction * rot) Also actually i made: //Set up alignment with terrain float rotation; osg::Vec3f origine; pat->getAtitude().getRotate(rotation, origine); if((osg::Vec3f(0,0,1)*normal) != 0){ osg

Re: [osg-users] Quaternion problem

2009-03-16 Thread Steven Saunderson
Antonin Linares wrote: > Hi osg users > > I use an intersectionVisitor to place tank model on my terrain > i made something like that: > > [...]osg::Quat rot(rotation, normal); > pat->setAtitude(corect*rot); //the tank was well oriented but > no more aligned with my terrain > } >

[osg-users] Quaternion problem

2009-03-16 Thread Antonin Linares
Hi osg users I use an intersectionVisitor to place tank model on my terrain i made something like that: [...] if(lsi->containIntersection()) { //get height and normal under the tank osg::Vec3f pos = lsi->getFirstIntersection()->getWorldIntersectionPoint(); osg::Vec3f normal = lsi->get