mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 07:23:52 +00:00
Merge branch 'cross_cell-borders' of https://github.com/greye/openmw.git into object_movement_creation
This commit is contained in:
commit
54221aab89
2 changed files with 18 additions and 18 deletions
|
@ -254,27 +254,28 @@ RenderingManager::rotateObject(
|
||||||
Ogre::Vector3 &rot,
|
Ogre::Vector3 &rot,
|
||||||
bool adjust)
|
bool adjust)
|
||||||
{
|
{
|
||||||
if (ptr.getRefData().getHandle() == "player") {
|
bool isPlayer = ptr.getRefData().getHandle() == "player";
|
||||||
if (adjust) {
|
bool force = true;
|
||||||
return mPlayer->adjustRotation(rot);
|
|
||||||
} else {
|
if (isPlayer) {
|
||||||
return mPlayer->setRotation(rot);
|
force = (adjust) ? mPlayer->adjustRotation(rot) : mPlayer->setRotation(rot);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
MWWorld::Class::get(ptr).adjustRotation(ptr, rot.x, rot.y, rot.z);
|
MWWorld::Class::get(ptr).adjustRotation(ptr, rot.x, rot.y, rot.z);
|
||||||
|
|
||||||
if (adjust) {
|
if (adjust) {
|
||||||
float *f = ptr.getRefData().getPosition().rot;
|
float *f = ptr.getRefData().getPosition().rot;
|
||||||
rot.x += f[0], rot.y += f[1], rot.z += f[2];
|
rot.x += Ogre::Radian(f[0]).valueDegrees();
|
||||||
|
rot.y += Ogre::Radian(f[1]).valueDegrees();
|
||||||
|
rot.z += Ogre::Radian(f[2]).valueDegrees();
|
||||||
|
}
|
||||||
|
if (!isPlayer) {
|
||||||
|
Ogre::Quaternion xr(Ogre::Degree(rot.x), Ogre::Vector3::UNIT_X);
|
||||||
|
Ogre::Quaternion yr(Ogre::Degree(rot.y), Ogre::Vector3::UNIT_Y);
|
||||||
|
Ogre::Quaternion zr(Ogre::Degree(rot.z), Ogre::Vector3::UNIT_Z);
|
||||||
|
|
||||||
|
ptr.getRefData().getBaseNode()->setOrientation(xr * yr * zr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ogre::Quaternion xr(Ogre::Degree(rot.x), Ogre::Vector3::UNIT_X);
|
return force;
|
||||||
Ogre::Quaternion yr(Ogre::Degree(rot.y), Ogre::Vector3::UNIT_Y);
|
|
||||||
Ogre::Quaternion zr(Ogre::Degree(rot.z), Ogre::Vector3::UNIT_Z);
|
|
||||||
|
|
||||||
ptr.getRefData().getBaseNode()->setOrientation(xr * yr * zr);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -140,19 +140,18 @@ namespace MWWorld
|
||||||
const ESM::Position& pos,
|
const ESM::Position& pos,
|
||||||
bool adjustPlayerPos)
|
bool adjustPlayerPos)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWorld()->getPlayer().setCell (cell);
|
|
||||||
|
|
||||||
bool hasWater = cell->cell->data.flags & cell->cell->HasWater;
|
bool hasWater = cell->cell->data.flags & cell->cell->HasWater;
|
||||||
mPhysics->setCurrentWater(hasWater, cell->cell->water);
|
mPhysics->setCurrentWater(hasWater, cell->cell->water);
|
||||||
|
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
world->getPlayer().setCell(cell);
|
||||||
|
|
||||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||||
|
|
||||||
if (adjustPlayerPos) {
|
if (adjustPlayerPos) {
|
||||||
world->moveObject(player, pos.pos[0], pos.pos[1], pos.pos[2]);
|
world->moveObject(player, pos.pos[0], pos.pos[1], pos.pos[2]);
|
||||||
world->rotateObject(player, pos.rot[0], pos.rot[1], pos.rot[2]);
|
world->rotateObject(player, pos.rot[0], pos.rot[1], pos.rot[2]);
|
||||||
}
|
}
|
||||||
world->getPlayer().setCell(cell);
|
|
||||||
|
|
||||||
MWMechanics::MechanicsManager *mechMgr =
|
MWMechanics::MechanicsManager *mechMgr =
|
||||||
MWBase::Environment::get().getMechanicsManager();
|
MWBase::Environment::get().getMechanicsManager();
|
||||||
|
|
Loading…
Reference in a new issue