You don't want to interpolate euler angles. You'll have issues with zero crossings and gimbal lock, unless you add a bunch of checks and conditionals.
Brian [EMAIL PROTECTED] wrote: ----- To: OpenSceneGraph Users <[email protected]> From: Stephan Maximilian Huber <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] Date: 09/30/2008 12:25PM Subject: Re: [osg-users] Smoothing camera movements from HMD's input. Hi Alessandro, alessandro terenzi schrieb: > I'm integrating a head mounted display (HMD) in my OSG application, the > HMD's APIs give me Euler's angles (yaw, pitch and roll) and I use them to > adjust my scene's camera view using an update callback. > > But I noticed that, changing camera view from frame to frame, results in > jerky movements, even when I try to rotate my head very slowly. > > In order to solve this problem, I was thinking about creating an animation > path (on the fly) from a previously stored orientation to current head > orientation. Is this the correct way to proceed? Or there is some other > technique to smooth the resulting camera movements? you can just interpolate the euler-angles: const float scalar(0.9f); currentYaw = currentYaw * scalar + newYaw * (1-scalar); curentPitch = currentPitch * scalar + newPitch * (1-scalar); currentRoll = currentRoll * scalar * newRoll * (1-scalar); current(Yaw|Pitch|Roll) are stord between successive frames and are used to construct the matrices. Depending on the scalar jerky movement gets flattened, you'll have to tweak the parameter to your needs. You can even interpolate between quads: osg::Quad newQuad = .. // construct the quad out of your euler angles currentQuad = currentQuad.slerp(currentQuad, newQuad, scalar); store currentquad for the next frame and use it to construct the view matrix, this is code out of my head, the chance is high, that it doesn't compile. Stephan _______________________________________________ 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

