[osg-users] Problem converting yaw,pitch,roll to quaternion

Guido Knapen guidoknapen at gmail.com
Mon Sep 7 00:30:23 PDT 2015


Sorry for late response was not at work until today.


gwaldron wrote:
> Try this:
> 
> --
> 
> 
> 
> Good luck.
> 
> Glenn Waldron
> 

Tried something similar, only I didn't negate the last vector. Will try this approach.

[quote="kornerr"]Hi.

I use the following function to convert from degrees to quaternions:


> Vec4 degreeToQuaternion(const Vec3 &degree) throw ()
> {
> osg::Quat q;
> q.makeRotate(osg::DegreesToRadians(degree.x), osg::Vec3(1, 0, 0),
> osg::DegreesToRadians(degree.y), osg::Vec3(0, 1, 0),
> osg::DegreesToRadians(degree.z), osg::Vec3(0, 0, 1));
> return Vec4(q.x(), q.y(), q.z(), q.w());
> }Vec4 is like osg::Vec4 for my own code.

Tried exactly this. Will try it again.

Thanks for help so far, will report back with results.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=65037#65037








More information about the osg-users mailing list