From 744c5804edf7d7646eddb6f85caa93f6d5a92197 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 7 Jul 2013 03:52:17 +0200 Subject: [PATCH] Simplified doors, now they will stop after hitting an obstacle instead of trying to back off. --- apps/openmw/mwworld/worldimp.cpp | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 0a1e0ccdc..06cf0099e 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1113,11 +1113,6 @@ namespace MWWorld float targetRot = std::min(std::max(0.f, oldRot + diff * (it->second ? 1 : -1)), 90.f); localRotateObject(it->first, 0, 0, targetRot); - // AABB of the door - Ogre::Vector3 min,max; - mPhysics->getObjectAABB(it->first, min, max); - Ogre::Vector3 dimensions = max-min; - /// \todo should use convexSweepTest here std::vector collisions = mPhysics->getCollisions(it->first); for (std::vector::iterator cit = collisions.begin(); cit != collisions.end(); ++cit) @@ -1125,23 +1120,8 @@ namespace MWWorld MWWorld::Ptr ptr = getPtrViaHandle(*cit); if (MWWorld::Class::get(ptr).isActor()) { - // we collided with an actor, we need to undo the rotation and push the door away from the actor - - // figure out on which side of the door the actor we collided with is - Ogre::Vector3 relativePos = it->first.getRefData().getBaseNode()-> - convertWorldToLocalPosition(ptr.getRefData().getBaseNode()->_getDerivedPosition()); - - float axisToCheck; - if (dimensions.x > dimensions.y) - axisToCheck = relativePos.y * boost::math::sign((min+max).y); - else - axisToCheck = relativePos.x * boost::math::sign((min+max).x); - if (axisToCheck >= 0) - targetRot = std::min(std::max(0.f, oldRot + diff*0.5f), 90.f); - else - targetRot = std::min(std::max(0.f, oldRot - diff*0.5f), 90.f); - - localRotateObject(it->first, 0, 0, targetRot); + // we collided with an actor, we need to undo the rotation + localRotateObject(it->first, 0, 0, oldRot); break; } }