mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
Fix door collision to work with all possible movement directions
This commit is contained in:
parent
93868c8bca
commit
c0dd383cd0
1 changed files with 7 additions and 1 deletions
|
@ -6,6 +6,8 @@
|
|||
#include <components/files/collections.hpp>
|
||||
#include <components/compiler/locals.hpp>
|
||||
|
||||
#include <boost/math/special_functions/sign.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
@ -1016,7 +1018,11 @@ namespace MWWorld
|
|||
Ogre::Vector3 relativePos = it->first.getRefData().getBaseNode()->
|
||||
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)
|
||||
targetRot = std::min(std::max(0.f, oldRot + diff*0.5f), 90.f);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue