setAngle improvement

actorid
gugus 13 years ago
parent 557e114992
commit 410b693555

@ -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";
}
}

@ -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();
};
}

@ -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());
}
}
};

@ -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());
}

Loading…
Cancel
Save