diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index ab4e2d5e6..0d2efcd9e 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -347,4 +347,11 @@ namespace MWClass return weight; } + + void Npc::adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const + { + y = 0; + x = 0; + std::cout << "dfdfdfdfnzdofnmqsldgnmqskdhblqkdbv lqksdf"; + } } diff --git a/apps/openmw/mwclass/npc.hpp b/apps/openmw/mwclass/npc.hpp index 4cb733977..f50ed2159 100644 --- a/apps/openmw/mwclass/npc.hpp +++ b/apps/openmw/mwclass/npc.hpp @@ -76,6 +76,8 @@ namespace MWClass ///< Returns total weight of objects inside this object (including modifications from magic /// effects). Throws an exception, if the object can't hold other objects. + virtual void adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const; + static void registerSelf(); }; } diff --git a/apps/openmw/mwscript/transformationextensions.cpp b/apps/openmw/mwscript/transformationextensions.cpp index 41eba4a99..2ea80c0d8 100644 --- a/apps/openmw/mwscript/transformationextensions.cpp +++ b/apps/openmw/mwscript/transformationextensions.cpp @@ -62,17 +62,21 @@ namespace MWScript Interpreter::Type_Float angle = runtime[0].mFloat; runtime.pop(); + float ax = Ogre::Radian(ptr.getRefData().getPosition().rot[0]).valueDegrees(); + float ay = Ogre::Radian(ptr.getRefData().getPosition().rot[1]).valueDegrees(); + float az = Ogre::Radian(ptr.getRefData().getPosition().rot[2]).valueDegrees(); + if(axis == "X") { - MWBase::Environment::get().getWorld()->rotateObject(ptr,angle,0,0); + MWBase::Environment::get().getWorld()->rotateObject(ptr,angle,ay,az); } if(axis == "Y") { - MWBase::Environment::get().getWorld()->rotateObject(ptr,0,angle,0); + MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,angle,az); } if(axis == "Z") { - MWBase::Environment::get().getWorld()->rotateObject(ptr,0,0,angle); + MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,angle); } } }; @@ -91,15 +95,15 @@ namespace MWScript if(axis == "X") { - runtime.push(ptr.getRefData().getPosition().rot[0]); + runtime.push(Ogre::Radian(ptr.getRefData().getPosition().rot[0]).valueDegrees()); } if(axis == "Y") { - runtime.push(ptr.getRefData().getPosition().rot[1]); + runtime.push(Ogre::Radian(ptr.getRefData().getPosition().rot[1]).valueDegrees()); } if(axis == "Z") { - runtime.push(ptr.getRefData().getPosition().rot[0]); + runtime.push(Ogre::Radian(ptr.getRefData().getPosition().rot[2]).valueDegrees()); } } }; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 5309fbe40..1e1fae154 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -602,7 +602,7 @@ namespace MWWorld MWWorld::Class::get(ptr).adjustScale(ptr,scale); ptr.getCellRef().scale = scale; - scale = scale/ptr.getRefData().getBaseNode()->getScale().x; + //scale = scale/ptr.getRefData().getBaseNode()->getScale().x; ptr.getRefData().getBaseNode()->setScale(scale,scale,scale); mPhysics->scaleObject( ptr.getRefData().getHandle(), scale ); } @@ -618,7 +618,7 @@ namespace MWWorld Ogre::Quaternion rotx(Ogre::Degree(x),Ogre::Vector3::UNIT_X); Ogre::Quaternion roty(Ogre::Degree(y),Ogre::Vector3::UNIT_Y); Ogre::Quaternion rotz(Ogre::Degree(z),Ogre::Vector3::UNIT_Z); - ptr.getRefData().getBaseNode()->setOrientation(rotx*roty*rotz); + ptr.getRefData().getBaseNode()->setOrientation(rotz*rotx*roty); mPhysics->rotateObject(ptr.getRefData().getHandle(),ptr.getRefData().getBaseNode()->getOrientation()); }