[osg-users] Quaternion problem

J.P. Delport jpdelport at csir.co.za
Tue Mar 17 04:03:48 PDT 2009


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 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->getFirstIntersection()->getWorldIntersectionPoint(); 
>> osg::Vec3f normal = 
>> lsi->getFirstIntersection()->getWorldIntersectionNormal(); 
>>
>> //Set up height 
>> pat->setPosition(pos);
> 
> All looks fine so far
> 
> 
> Antonin Linares wrote:
>> //Set up alignment with terrain 
>> float rotation; 
>> osg::Vec3f origine; 
>> pat->getAtitude().getRotate(rotation, origine); 
>>
>> if((origine*normal) != 0){ 
>> osg::Quat corect; 
>> corect.makeRotation(origine, normal); 
>>
>> pat->setAtitude(corect);
> 
> 
> I don't understand why you have the getAtitude() here.  It will return a quat and the .getRotate will convert the value into an angle and vector.  But what quat value is it converting ?
> 
> What happens if you always calculate "corect" as you are doing and then apply "rot" in the setAtitude call (i.e. pat->setAtitude (rot * corect) ) ?
> 
> //Set up alignment with terrain 
> float rotation; 
> osg::Vec3f origine (0,0,1); 
> osg::Quat corect; 
> corect.makeRotation(origine, normal); 
> 
> // I'm not sure where you get rotation from ??????
> 
> osg::Quat rot(rotation, origine); 
> pat->setAtitude(rot*corect);
> 
> I hope this helps or entices someone more knowledgeable to assist here.
> 
> ------------------------
> -- Steven Saunderson
> 
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=8598#8598
> 
> 
> 
> 
> 
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 

-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

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.




More information about the osg-users mailing list