From c179977f206b35fef854dbfdf8d4b8cd2a4df9d6 Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 25 Mar 2015 01:58:41 +0100 Subject: [PATCH] Fix quaternion rotation order --- components/nifosg/controller.cpp | 2 +- components/nifosg/particle.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/nifosg/controller.cpp b/components/nifosg/controller.cpp index 0e1f15f0f..a31263d8b 100644 --- a/components/nifosg/controller.cpp +++ b/components/nifosg/controller.cpp @@ -135,7 +135,7 @@ osg::Quat KeyframeController::getXYZRotation(float time) const osg::Quat xr(xrot, osg::Vec3f(1,0,0)); osg::Quat yr(yrot, osg::Vec3f(0,1,0)); osg::Quat zr(zrot, osg::Vec3f(0,0,1)); - return (zr*yr*xr); + return (xr*yr*zr); } osg::Vec3f KeyframeController::getTranslation(float time) const diff --git a/components/nifosg/particle.cpp b/components/nifosg/particle.cpp index 25970c862..899ce7537 100644 --- a/components/nifosg/particle.cpp +++ b/components/nifosg/particle.cpp @@ -77,7 +77,7 @@ void ParticleShooter::shoot(osgParticle::Particle *particle) const float hdir = mHorizontalDir + mHorizontalAngle * (2.f * (std::rand() / static_cast(RAND_MAX)) - 1.f); float vdir = mVerticalDir + mVerticalAngle * (2.f * (std::rand() / static_cast(RAND_MAX)) - 1.f); float vdir2 = mVerticalDir + mVerticalAngle * (2.f * (std::rand() / static_cast(RAND_MAX)) - 1.f); - osg::Vec3f dir = osg::Quat(hdir, osg::Vec3f(0,0,1)) * osg::Quat(vdir, osg::Vec3f(0,1,0)) * osg::Quat(vdir2, osg::Vec3f(1,0,0)) + osg::Vec3f dir = (osg::Quat(vdir2, osg::Vec3f(1,0,0)) * osg::Quat(vdir, osg::Vec3f(0,1,0)) * osg::Quat(hdir, osg::Vec3f(0,0,1))) * osg::Vec3f(0,0,1); float vel = mMinSpeed + (mMaxSpeed - mMinSpeed) * std::rand() / static_cast(RAND_MAX);