fix move/rotateObject code

actorid
greye 13 years ago
parent 2ebf4721d1
commit f7f8ac0a73

@ -254,7 +254,8 @@ RenderingManager::rotateObject(
Ogre::Vector3 &rot,
bool adjust)
{
bool isPlayer = ptr.getRefData().getHandle() == "player";
bool isActive = ptr.getRefData().getBaseNode() != 0;
bool isPlayer = isActive && ptr.getRefData().getHandle() == "player";
bool force = true;
if (isPlayer) {
@ -271,7 +272,7 @@ RenderingManager::rotateObject(
float *f = ptr.getRefData().getPosition().rot;
rot.x += f[0], rot.y += f[1], rot.z += f[2];
}
if (!isPlayer) {
if (!isPlayer && isActive) {
Ogre::Quaternion xr(Ogre::Radian(rot.x), Ogre::Vector3::UNIT_X);
Ogre::Quaternion yr(Ogre::Radian(rot.y), Ogre::Vector3::UNIT_Y);
Ogre::Quaternion zr(Ogre::Radian(rot.z), Ogre::Vector3::UNIT_Z);

@ -563,9 +563,9 @@ namespace MWWorld
mWorldScene->changeCell(cellX, cellY, pos, false);
}
} else {
if (!mWorldScene->isCellActive(newCell)) {
if (!mWorldScene->isCellActive(*currCell)) {
copyObjectToCell(ptr, newCell, pos);
} else if (!mWorldScene->isCellActive(*currCell)) {
} else if (!mWorldScene->isCellActive(newCell)) {
MWWorld::Class::get(ptr).copyToCell(ptr, newCell);
mWorldScene->removeObjectFromScene(ptr);
mLocalScripts.remove(ptr);
@ -640,10 +640,12 @@ namespace MWWorld
float *objRot = ptr.getRefData().getPosition().rot;
objRot[0] = rot.x, objRot[1] = rot.y, objRot[2] = rot.z;
mPhysics->rotateObject(
ptr.getRefData().getHandle(),
ptr.getRefData().getBaseNode()->getOrientation()
);
if (ptr.getRefData().getBaseNode() != 0) {
mPhysics->rotateObject(
ptr.getRefData().getHandle(),
ptr.getRefData().getBaseNode()->getOrientation()
);
}
}
}

Loading…
Cancel
Save