1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 05:53:50 +00:00

Fix door collision to work with all possible movement directions

This commit is contained in:
scrawl 2013-04-30 09:43:32 +02:00
parent 93868c8bca
commit c0dd383cd0

View file

@ -6,6 +6,8 @@
#include <components/files/collections.hpp> #include <components/files/collections.hpp>
#include <components/compiler/locals.hpp> #include <components/compiler/locals.hpp>
#include <boost/math/special_functions/sign.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
@ -1016,7 +1018,11 @@ namespace MWWorld
Ogre::Vector3 relativePos = it->first.getRefData().getBaseNode()-> Ogre::Vector3 relativePos = it->first.getRefData().getBaseNode()->
convertWorldToLocalPosition(ptr.getRefData().getBaseNode()->_getDerivedPosition()); convertWorldToLocalPosition(ptr.getRefData().getBaseNode()->_getDerivedPosition());
float axisToCheck = (dimensions.x > dimensions.y) ? relativePos.y : -relativePos.x; 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) if (axisToCheck >= 0)
targetRot = std::min(std::max(0.f, oldRot + diff*0.5f), 90.f); targetRot = std::min(std::max(0.f, oldRot + diff*0.5f), 90.f);
else else